From 364f70401c27768c83822c818cab33da147eb333 Mon Sep 17 00:00:00 2001 From: brecht stamper Date: Thu, 22 Feb 2024 11:06:55 +0100 Subject: [PATCH] sort by label keys --- .../src/opentelemetry/exporter/prometheus/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py index b1a8d668c46..6cde540ef6f 100644 --- a/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py +++ b/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py @@ -237,7 +237,7 @@ def _translate_to_prometheus( label_keys = [] label_values = [] - for key, value in number_data_point.attributes.items(): + for key, value in sorted(number_data_point.attributes.items()): label_keys.append(self._sanitize(key)) label_values.append(self._check_value(value))