Skip to content

Commit b890974

Browse files
committed
remove OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION from exporter-prometheus
Signed-off-by: emdneto <[email protected]>
1 parent 189fa15 commit b890974

File tree

4 files changed

+4
-54
lines changed

4 files changed

+4
-54
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
([#4094](https://github.com/open-telemetry/opentelemetry-python/pull/4094))
1818
- Implement events sdk
1919
([#4176](https://github.com/open-telemetry/opentelemetry-python/pull/4176))
20+
- Drop `OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION`
21+
environment variable
22+
([#4217](https://github.com/open-telemetry/opentelemetry-python/pull/4217))
2023

2124
## Version 1.27.0/0.48b0 (2024-08-28)
2225

exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/__init__.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
from opentelemetry.sdk.environment_variables import (
8888
OTEL_EXPORTER_PROMETHEUS_HOST,
8989
OTEL_EXPORTER_PROMETHEUS_PORT,
90-
OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION,
9190
)
9291
from opentelemetry.sdk.metrics import Counter
9392
from opentelemetry.sdk.metrics import Histogram as HistogramInstrument
@@ -234,18 +233,7 @@ def _translate_to_prometheus(
234233

235234
metric_description = metric.description or ""
236235

237-
# TODO(#3929): remove this opt-out option
238-
disable_unit_normalization = (
239-
environ.get(
240-
OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION,
241-
"false",
242-
).lower()
243-
== "true"
244-
)
245-
if disable_unit_normalization:
246-
metric_unit = metric.unit
247-
else:
248-
metric_unit = map_unit(metric.unit)
236+
metric_unit = map_unit(metric.unit)
249237

250238
for number_data_point in metric.data.data_points:
251239
label_keys = []

exporter/opentelemetry-exporter-prometheus/tests/test_prometheus_exporter.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from os import environ
1615
from textwrap import dedent
1716
from unittest import TestCase
1817
from unittest.mock import Mock, patch
@@ -28,9 +27,6 @@
2827
PrometheusMetricReader,
2928
_CustomCollector,
3029
)
31-
from opentelemetry.sdk.environment_variables import (
32-
OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION,
33-
)
3430
from opentelemetry.sdk.metrics import MeterProvider
3531
from opentelemetry.sdk.metrics.export import (
3632
AggregationTemporality,
@@ -551,25 +547,6 @@ def test_metric_name_with_unit(self):
551547
),
552548
)
553549

554-
# TODO(#3929): remove this opt-out option
555-
@patch.dict(
556-
environ,
557-
{
558-
OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION: "true"
559-
},
560-
)
561-
def test_metric_name_with_unit_normalization_disabled(self):
562-
self.verify_text_format(
563-
_generate_sum(name="test_unit_not_normalized", value=1, unit="s"),
564-
dedent(
565-
"""\
566-
# HELP test_unit_not_normalized_s_total foo
567-
# TYPE test_unit_not_normalized_s_total counter
568-
test_unit_not_normalized_s_total{a="1",b="true"} 1.0
569-
"""
570-
),
571-
)
572-
573550
def test_semconv(self):
574551
"""Tests that a few select semconv metrics get converted to the expected prometheus
575552
text format"""

opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -780,21 +780,3 @@
780780
This is an experimental environment variable and the name of this variable and its behavior can
781781
change in a non-backwards compatible way.
782782
"""
783-
784-
785-
# TODO(#3929): remove this opt-out option
786-
OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION = (
787-
"OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION"
788-
)
789-
"""
790-
.. envvar:: OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION
791-
792-
The :envvar:`OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION` environment
793-
variable allows you to opt-out of the unit normalization described `in the specification
794-
<https://github.com/open-telemetry/opentelemetry-specification/blob/v1.33.0/specification/compatibility/prometheus_and_openmetrics.md#metric-metadata-1>`_.
795-
796-
Default: False
797-
798-
This is an temporary environment variable that provides backward compatibility but will be
799-
removed in the future https://github.com/open-telemetry/opentelemetry-python/issues/3929.
800-
"""

0 commit comments

Comments
 (0)