Render latency chart if ACLK online (#20811)
ACLK latency chart if aclk online
Stelios Fragkakis committed
Aug 13, 2025 at 03:03 UTC
35fc04efd2c7da543aaf629620b8971c917f177a
1 file changed
+37
-37
src/daemon/pulse/pulse-network.c
+37
-37
@@ -473,44 +473,44 @@ void pulse_network_do(bool extended __maybe_unused) {
473
rrddim_set_by_pointer(st_aclk_send_wait, rd_partial, (collected_number)t.mqtt.max_partial_wait_us);
474
rrdset_done(st_aclk_send_wait);
475
}
476
- }
476
478
- // Publish PUBACK latency min/avg/max per iteration
479
- {
480
- static RRDSET *st_stats = NULL;
481
- static RRDDIM *rd_min = NULL, *rd_avg = NULL, *rd_max = NULL;
482
-
483
- // pull and reset accumulators
484
- uint64_t count = __atomic_exchange_n(&aclk_ack_count, 0, __ATOMIC_RELAXED);
485
- uint64_t sum_us = __atomic_exchange_n(&aclk_ack_sum_us, 0, __ATOMIC_RELAXED);
486
- uint64_t min_us = __atomic_exchange_n(&aclk_ack_min_us, UINT64_MAX, __ATOMIC_RELAXED);
487
- uint64_t max_us = __atomic_exchange_n(&aclk_ack_max_us, 0, __ATOMIC_RELAXED);
488
-
489
- uint64_t avg_us = (count ? (sum_us / count) : 0);
490
- if (min_us == UINT64_MAX) min_us = 0;
491
-
492
- if (unlikely(!st_stats)) {
493
- st_stats = rrdset_create_localhost(
494
- "netdata",
495
- "aclk_puback_latency_stats",
496
- NULL,
497
- PULSE_NETWORK_CHART_FAMILY,
498
- "netdata.aclk_puback_latency_stats",
499
- "Netdata ACLK PubACK Latency (Min/Avg/Max)",
500
- "milliseconds",
501
- "netdata",
502
- "pulse",
503
- PULSE_NETWORK_CHART_PRIORITY + 1,
504
- localhost->rrd_update_every,
505
- RRDSET_TYPE_LINE);
506
- rd_min = rrddim_add(st_stats, "min", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
507
- rd_avg = rrddim_add(st_stats, "avg", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
508
- rd_max = rrddim_add(st_stats, "max", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
509
- }
477
+ // Publish PUBACK latency min/avg/max per iteration
478
+ {
479
+ static RRDSET *st_stats = NULL;
480
+ static RRDDIM *rd_min = NULL, *rd_avg = NULL, *rd_max = NULL;
481
+
482
+ // pull and reset accumulators
483
+ uint64_t count = __atomic_exchange_n(&aclk_ack_count, 0, __ATOMIC_RELAXED);
484
+ uint64_t sum_us = __atomic_exchange_n(&aclk_ack_sum_us, 0, __ATOMIC_RELAXED);
485
+ uint64_t min_us = __atomic_exchange_n(&aclk_ack_min_us, UINT64_MAX, __ATOMIC_RELAXED);
486
+ uint64_t max_us = __atomic_exchange_n(&aclk_ack_max_us, 0, __ATOMIC_RELAXED);
487
+
488
+ uint64_t avg_us = (count ? (sum_us / count) : 0);
489
+ if (min_us == UINT64_MAX) min_us = 0;
490
+
491
+ if (unlikely(!st_stats)) {
492
+ st_stats = rrdset_create_localhost(
493
+ "netdata",
494
+ "aclk_puback_latency_stats",
495
+ NULL,
496
+ PULSE_NETWORK_CHART_FAMILY,
497
+ "netdata.aclk_puback_latency_stats",
498
+ "Netdata ACLK PubACK Latency (Min/Avg/Max)",
499
+ "milliseconds",
500
+ "netdata",
501
+ "pulse",
502
+ PULSE_NETWORK_CHART_PRIORITY + 1,
503
+ localhost->rrd_update_every,
504
+ RRDSET_TYPE_LINE);
505
+ rd_min = rrddim_add(st_stats, "min", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
506
+ rd_avg = rrddim_add(st_stats, "avg", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
507
+ rd_max = rrddim_add(st_stats, "max", NULL, 1, USEC_PER_MS, RRD_ALGORITHM_ABSOLUTE);
508
+ }
509
511
- rrddim_set_by_pointer(st_stats, rd_min, (collected_number)min_us);
512
- rrddim_set_by_pointer(st_stats, rd_avg, (collected_number)avg_us);
513
- rrddim_set_by_pointer(st_stats, rd_max, (collected_number)max_us);
514
- rrdset_done(st_stats);
510
+ rrddim_set_by_pointer(st_stats, rd_min, (collected_number)min_us);
511
+ rrddim_set_by_pointer(st_stats, rd_avg, (collected_number)avg_us);
512
+ rrddim_set_by_pointer(st_stats, rd_max, (collected_number)max_us);
513
+ rrdset_done(st_stats);
514
+ }
515
}
516
}