Skip to content

Commit fe4ab6a

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent c6be6fe commit fe4ab6a

File tree

4 files changed

+21
-35
lines changed

4 files changed

+21
-35
lines changed

micrometer-support/src/main/java/io/javaoperatorsdk/operator/monitoring/micrometer/MicrometerMetricsV2.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class MicrometerMetricsV2 implements Metrics {
6666
private static final String NUMBER_OF_RESOURCE_GAUGE = "custom_resources";
6767

6868
private static final String RECONCILIATION_EXECUTION_DURATION =
69-
RECONCILIATIONS + "execution.seconds";
69+
RECONCILIATIONS + "execution.duration";
7070

7171
private final MeterRegistry registry;
7272
private final Map<String, AtomicInteger> gauges = new ConcurrentHashMap<>();
@@ -195,6 +195,7 @@ public void receivedEvent(Event event, Map<String, Object> metadata) {
195195

196196
@Override
197197
public void cleanupDoneFor(ResourceID resourceID, Map<String, Object> metadata) {
198+
gauges.get(numberOfResourcesRefName(getControllerName(metadata))).decrementAndGet();
198199
incrementCounter(EVENTS_DELETE, resourceID.getNamespace().orElse(null), metadata);
199200
}
200201

observability/josdk-operator-metrics-dashboard.json

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -513,26 +513,13 @@
513513
"fieldConfig": {
514514
"defaults": {
515515
"color": {
516-
"mode": "thresholds"
516+
"mode": "palette-classic"
517517
},
518-
"mappings": [],
519-
"thresholds": {
520-
"mode": "absolute",
521-
"steps": [
522-
{
523-
"color": "blue",
524-
"value": null
525-
},
526-
{
527-
"color": "green",
528-
"value": 10
529-
},
530-
{
531-
"color": "yellow",
532-
"value": 100
533-
}
534-
]
518+
"custom": {
519+
"lineWidth": 2,
520+
"fillOpacity": 10
535521
},
522+
"mappings": [],
536523
"unit": "short"
537524
},
538525
"overrides": []
@@ -545,16 +532,14 @@
545532
},
546533
"id": 13,
547534
"options": {
548-
"colorMode": "value",
549-
"graphMode": "area",
550-
"justifyMode": "auto",
551-
"orientation": "horizontal",
552-
"reduceOptions": {
553-
"values": false,
554-
"calcs": ["lastNotNull"],
555-
"fields": ""
535+
"tooltip": {
536+
"mode": "multi",
537+
"sort": "none"
556538
},
557-
"textMode": "auto"
539+
"legend": {
540+
"displayMode": "list",
541+
"placement": "bottom"
542+
}
558543
},
559544
"pluginVersion": "10.0.0",
560545
"targets": [
@@ -571,7 +556,7 @@
571556
}
572557
],
573558
"title": "Custom Resources Count",
574-
"type": "stat"
559+
"type": "timeseries"
575560
},
576561
{
577562
"datasource": {
@@ -654,7 +639,7 @@
654639
"uid": "prometheus"
655640
},
656641
"editorMode": "code",
657-
"expr": "histogram_quantile(0.50, sum(rate(reconciliations_execution_seconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
642+
"expr": "histogram_quantile(0.50, sum(rate(reconciliations_execution_duration_milliseconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
658643
"legendFormat": "p50 - {{controller_name}}",
659644
"range": true,
660645
"refId": "A"
@@ -665,7 +650,7 @@
665650
"uid": "prometheus"
666651
},
667652
"editorMode": "code",
668-
"expr": "histogram_quantile(0.95, sum(rate(reconciliations_execution_seconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
653+
"expr": "histogram_quantile(0.95, sum(rate(reconciliations_execution_duration_milliseconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
669654
"legendFormat": "p95 - {{controller_name}}",
670655
"range": true,
671656
"refId": "B"
@@ -676,7 +661,7 @@
676661
"uid": "prometheus"
677662
},
678663
"editorMode": "code",
679-
"expr": "histogram_quantile(0.99, sum(rate(reconciliations_execution_seconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
664+
"expr": "histogram_quantile(0.99, sum(rate(reconciliations_execution_duration_milliseconds_bucket{service_name=~\"$service_name\"}[5m])) by (le, controller_name))",
680665
"legendFormat": "p99 - {{controller_name}}",
681666
"range": true,
682667
"refId": "C"
@@ -780,7 +765,7 @@
780765
"type": "prometheus",
781766
"uid": "prometheus"
782767
},
783-
"description": "Failures by controller",
768+
"description": "Reconciliation failures",
784769
"fieldConfig": {
785770
"defaults": {
786771
"color": {

sample-operators/metrics-processing/src/main/resources/otlp-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ otlp:
1818
# OTLP Collector endpoint - see observability/install-observability.sh for setup
1919
# url: "http://localhost:4318/v1/metrics"
2020
url: "http://otel-collector-collector.observability.svc.cluster.local:4318/v1/metrics"
21-
step: 10s
21+
step: 5s
2222
batchSize: 15000
2323
aggregationTemporality: "cumulative"

sample-operators/metrics-processing/src/test/java/io/javaoperatorsdk/operator/sample/metrics/MetricsHandlingE2E.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private void verifyPrometheusMetrics() {
206206
assertMetricPresent(prometheusUrl, "reconciliations_success_total", Duration.ofSeconds(30));
207207
assertMetricPresent(prometheusUrl, "reconciliations_failure_total", Duration.ofSeconds(30));
208208
assertMetricPresent(
209-
prometheusUrl, "reconciliations_execution_seconds_count", Duration.ofSeconds(30));
209+
prometheusUrl, "reconciliations_execution_duration_milliseconds_count", Duration.ofSeconds(30));
210210

211211
log.info("All metrics verified successfully in Prometheus");
212212
}

0 commit comments

Comments
 (0)