You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix duplicate HELP/TYPE declarations in Prometheus exporter (#4869)
Fixes#4868
The Prometheus exporter was generating duplicate HELP and TYPE
declarations for metrics with varying label sets, violating the
Prometheus format specification and causing rejection by Prometheus
Pushgateway with the error: "second HELP line for metric name."
Changes:
- Modified metric family ID to exclude label keys, using only metric
name, description, and unit
- Implemented two-pass processing: first pass collects all unique
label keys across data points, second pass builds label values with
empty strings for missing labels
- Ensured single metric family per metric type with consolidated
label keys
- Updated test expectations to verify single HELP/TYPE declaration
with proper empty string handling for missing labels
This aligns with the Go implementation approach and ensures
compatibility with Prometheus Pushgateway and other strict validators.
Co-authored-by: Aaron Abbott <[email protected]>
# The prometheus compatibility spec for sums says: If the aggregation temporality is cumulative and the sum is non-monotonic, it MUST be converted to a Prometheus Gauge.
288
-
should_convert_sum_to_gauge= (
289
-
is_non_monotonic_sumandis_cumulative
290
-
)
261
+
# Second pass: build label values with empty strings for missing labels
# The prometheus compatibility spec for sums says: If the aggregation temporality is cumulative and the sum is non-monotonic, it MUST be converted to a Prometheus Gauge.
0 commit comments