1717 * Helper class to query OTEL Collector's Prometheus metrics endpoint.
1818 *
1919 * Used to verify that telemetry data flows through the collector.
20- * Queries `otelcol_exporter_sent_*_total ` metrics which indicate data was
20+ * Queries `otelcol_exporter_sent_*` metrics which indicate data was
2121 * successfully exported (more reliable than receiver metrics in v0.115+).
22+ * Collector v0.153.0 drops the `_total` suffix on these counters.
2223 * The collector exposes internal metrics at port 8888.
2324 */
2425final readonly class CollectorMetrics
@@ -31,17 +32,17 @@ public function __construct(
3132
3233 public function getAcceptedLogRecords (): int
3334 {
34- return $ this ->getMetricValue ('otelcol_exporter_sent_log_records_total ' );
35+ return $ this ->getMetricValue ('otelcol_exporter_sent_log_records ' );
3536 }
3637
3738 public function getAcceptedMetricPoints (): int
3839 {
39- return $ this ->getMetricValue ('otelcol_exporter_sent_metric_points_total ' );
40+ return $ this ->getMetricValue ('otelcol_exporter_sent_metric_points ' );
4041 }
4142
4243 public function getAcceptedSpans (): int
4344 {
44- return $ this ->getMetricValue ('otelcol_exporter_sent_spans_total ' );
45+ return $ this ->getMetricValue ('otelcol_exporter_sent_spans ' );
4546 }
4647
4748 /**
@@ -53,7 +54,7 @@ public function getAcceptedSpans(): int
5354 */
5455 public function waitForLogRecords (int $ threshold , int $ timeoutMs = 5000 , int $ pollIntervalMs = 10 ): int
5556 {
56- return $ this ->waitForMetric ('otelcol_exporter_sent_log_records_total ' , $ threshold , $ timeoutMs , $ pollIntervalMs );
57+ return $ this ->waitForMetric ('otelcol_exporter_sent_log_records ' , $ threshold , $ timeoutMs , $ pollIntervalMs );
5758 }
5859
5960 /**
@@ -65,12 +66,7 @@ public function waitForLogRecords(int $threshold, int $timeoutMs = 5000, int $po
6566 */
6667 public function waitForMetricPoints (int $ threshold , int $ timeoutMs = 5000 , int $ pollIntervalMs = 10 ): int
6768 {
68- return $ this ->waitForMetric (
69- 'otelcol_exporter_sent_metric_points_total ' ,
70- $ threshold ,
71- $ timeoutMs ,
72- $ pollIntervalMs ,
73- );
69+ return $ this ->waitForMetric ('otelcol_exporter_sent_metric_points ' , $ threshold , $ timeoutMs , $ pollIntervalMs );
7470 }
7571
7672 /**
@@ -82,7 +78,7 @@ public function waitForMetricPoints(int $threshold, int $timeoutMs = 5000, int $
8278 */
8379 public function waitForSpans (int $ threshold , int $ timeoutMs = 5000 , int $ pollIntervalMs = 10 ): int
8480 {
85- return $ this ->waitForMetric ('otelcol_exporter_sent_spans_total ' , $ threshold , $ timeoutMs , $ pollIntervalMs );
81+ return $ this ->waitForMetric ('otelcol_exporter_sent_spans ' , $ threshold , $ timeoutMs , $ pollIntervalMs );
8682 }
8783
8884 private function getMetricValue (string $ metricName ): int
0 commit comments