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))