Skip to content

Commit 84c6b0a

Browse files
authored
Merge branch 'main' into fix-memory-leak
2 parents 7b20bf8 + 679297f commit 84c6b0a

File tree

4 files changed

+3
-55
lines changed

4 files changed

+3
-55
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929
([#4208](https://github.com/open-telemetry/opentelemetry-python/pull/4208))
3030
- Fix memory leak in exporter and reader
3131
([#4224](https://github.com/open-telemetry/opentelemetry-python/pull/4224))
32-
32+
- Drop `OTEL_PYTHON_EXPERIMENTAL_DISABLE_PROMETHEUS_UNIT_NORMALIZATION` environment variable
33+
([#4217](https://github.com/open-telemetry/opentelemetry-python/pull/4217))
3334

3435
## Version 1.27.0/0.48b0 (2024-08-28)
3536

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 (
9392
Counter,
@@ -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,
@@ -549,25 +545,6 @@ def test_metric_name_with_unit(self):
549545
),
550546
)
551547

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