]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
test/packaging/interactive/metrics: compare number of JSON and prometheus metrics docs-prometheus-m-rqpbzm/deployments/6985
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 11 Jun 2025 10:01:36 +0000 (12:01 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 11 Jun 2025 10:48:12 +0000 (12:48 +0200)
tests/packaging/interactive/metrics.sh

index fbf2ff3998b1c80136aac8bd537a1e2b57552dd6..5c5932a9e110cfc20672530636b4f3657d072c92 100755 (executable)
@@ -15,3 +15,12 @@ if [ "$?" -ne "0" ]; then
        echo "Could not get metrics in Prometheus format"
        exit 1
 fi
+
+json_count=$(kresctl metrics | grep --invert-match '{\|}' --count)
+prometheus_count=$(kresctl metrics --prometheus | grep --invert-match '^#' | grep '^resolver' --count)
+worker_count=$(kresctl metrics | grep --fixed-strings 'kresd:' --count)
+# Prometheus additionally contains resolver_response_latency_count and resolver_metrics_loaded
+if [ $(($json_count + 2 * $worker_count)) -ne $prometheus_count ]; then
+       echo "JSON and Prometheus have different number of base metrics"
+       exit 1
+fi