Skip to content

Commit

Permalink
Filter prometheus metrics and initilice the test gauge
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Aug 19, 2023
1 parent e4c57d1 commit 518da9b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 34 deletions.
41 changes: 11 additions & 30 deletions deps/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,14 @@ extraScrapeConfigs: |
- targets:
- keda-admission-webhooks.keda:8080
alertmanager:
enabled: false
prometheus-pushgateway:
enabled: false
grafana:
enabled: false
kubernetesServiceMonitors:
enabled: false
kubeApiServer:
enabled: false
kubelet:
enabled: false
kubeControllerManager:
enabled: false
coreDns:
enabled: false
kubeEtcd:
enabled: false
kubeScheduler:
enabled: false
kubeProxy:
enabled: false
kubeStateMetrics:
enabled: false
nodeExporter:
enabled: false
kube-state-metrics:
enabled: false
prometheus-node-exporter:
enabled: false
server:
remoteWrite:
- write_relabel_configs:
# KEDA metrics used during tests
- source_labels: [__name__]
regex: "keda_internal_scale_loop_latency|keda_resource_totals"
action: keep
# Container usage metrics
- source_labels: [__name__]
regex: "^container_.*"
action: keep
8 changes: 8 additions & 0 deletions shared/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as prometheus from "./prometheus.js";

import { sleep } from "k6";
import crypto from "k6/crypto";
import { Gauge } from "k6/metrics";

export function waitForResourceCount(
namespace,
Expand All @@ -26,3 +28,9 @@ export function waitForResourceCount(
export function generatePrefix(testCase) {
return crypto.md5(testCase, "hex");
}

export function generateGauge(name){
var gauge = new Gauge(name);
gauge.add(0);
return gauge;
}
7 changes: 3 additions & 4 deletions tests/test-scaledobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import * as workload from "../shared/scaledobject-workload.js";

import { sleep } from "k6";
import { describe } from "https://jslib.k6.io/k6chaijs/4.3.4.3/index.js";
import { Gauge } from "k6/metrics";

const GaugeKEDAInternalLatency = new Gauge("keda_internal_latency");
const GaugeKEDAInternalLatency = utils.generateGauge("keda_internal_latency");
const scaledObjectCount = config.getTargetScalableObjectCount();
const metricsPerScaledObject = config.getTargetMetricCount();
const testCaseName = `${scaledObjectCount}-ScaleObjects-${metricsPerScaledObject}-Metrics`;
Expand Down Expand Up @@ -62,9 +61,9 @@ export function setup() {
);
}

export default function () {
export default function () {
GaugeKEDAInternalLatency.add(prometheus.getLag(workload.getNamespaceName()));
sleep(15);
sleep(10);
}

export function teardown() {
Expand Down

0 comments on commit 518da9b

Please sign in to comment.