From a7835d8f035fef6403de182478a1af1800c893ed Mon Sep 17 00:00:00 2001 From: Truong Nguyen Date: Fri, 3 Jul 2026 13:55:45 +0200 Subject: [PATCH] tests: assert histogram/exp_histogram temporality survives in_opentelemetry -> out_opentelemetry round trip The fix itself (fluent/cmetrics#279) is already included via the lib: cmetrics: upgrade to v2.2.0 bump on master. tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py::test_opentelemetry_to_opentelemetry_histogram_and_gauge_metrics already sends a histogram with aggregation_temporality=1 (DELTA) through a real in_opentelemetry -> out_opentelemetry pipeline (test_metrics_002.in.json), but never asserted on the output's aggregationTemporality field. That gap is exactly how the cmetrics bug (histograms/exp_histograms losing their OTLP temporality across Fluent Bit's internal msgpack buffer) went unnoticed. Adds the missing assertion so a regression here is caught going forward. Verified locally against both sides of the cmetrics fix: - Built Fluent Bit with lib/cmetrics reverted to pre-v2.2.0 (unpatched): this test fails - the response's histogram has no aggregationTemporality field at all, since UNSPECIFIED is omitted by proto JSON serialization. - Built Fluent Bit with lib/cmetrics at v2.2.0 (patched): this test passes, with aggregationTemporality: AGGREGATION_TEMPORALITY_DELTA correctly present in the OTLP output. - Full in_opentelemetry (62 tests) and out_opentelemetry (17 tests) suites pass with no regressions. Also reproduced end-to-end against a real cluster: ran a k6 OTLP load test through in_opentelemetry -> out_opentelemetry -> Prometheus with the unpatched image (k6's histogram metrics were rejected by Prometheus with "invalid temporality and type combination") and again with a patched image (same metrics landed correctly, confirmed via direct Prometheus API query). Signed-off-by: Truong Nguyen --- .../in_opentelemetry/tests/test_in_opentelemetry_001.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py b/tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py index 68f4a2808d2..bdf19e45c8a 100644 --- a/tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py +++ b/tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py @@ -743,6 +743,12 @@ def test_opentelemetry_to_opentelemetry_histogram_and_gauge_metrics(): assert histogram_datapoint["explicitBounds"] == [100.0] assert histogram_datapoint["attributes"][0]["key"] == "http.route" assert histogram_datapoint["attributes"][0]["value"]["stringValue"] == "/checkout" + # test_metrics_002.in.json declares this histogram with + # aggregation_temporality=1 (DELTA). in_opentelemetry decodes it into + # cmetrics and out_opentelemetry re-encodes it after a round trip + # through Fluent Bit's internal msgpack storage; that temporality must + # survive the round trip unchanged. + assert histogram["aggregationTemporality"] == "AGGREGATION_TEMPORALITY_DELTA" assert metrics["cpu.usage"]["scope_version"] == "2.0.0" assert gauge_datapoint["asDouble"] == 0.82