From e975fd800e8ef4efc50688436ddd6ee15b4433ad Mon Sep 17 00:00:00 2001 From: Thomas Pierce Date: Mon, 10 Jun 2024 19:37:36 +0000 Subject: [PATCH] Remove OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION setting logic --- .../distro/aws_opentelemetry_distro.py | 18 +++--------------- .../test_aws_opentelementry_configurator.py | 3 --- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py index 9bca8acd1..3f8838083 100644 --- a/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py +++ b/aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py @@ -7,10 +7,7 @@ from amazon.opentelemetry.distro.patches._instrumentation_patch import apply_instrumentation_patches from opentelemetry.distro import OpenTelemetryDistro from opentelemetry.environment_variables import OTEL_PROPAGATORS, OTEL_PYTHON_ID_GENERATOR -from opentelemetry.sdk.environment_variables import ( - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION, - OTEL_EXPORTER_OTLP_PROTOCOL, -) +from opentelemetry.sdk.environment_variables import OTEL_EXPORTER_OTLP_PROTOCOL _logger: Logger = getLogger(__name__) @@ -25,20 +22,14 @@ def _configure(self, **kwargs): due to gRPC having a strict dependency on the Python version the artifact was built for (OTEL observed this: https://github.com/open-telemetry/opentelemetry-operator/blob/461ba68e80e8ac6bf2603eb353547cd026119ed2/autoinstrumentation/python/requirements.txt#L2-L3) - Also sets default OTEL_PROPAGATORS, OTEL_PYTHON_ID_GENERATOR, and - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION to ensure good compatibility with X-Ray and Application - Signals. + Also sets default OTEL_PROPAGATORS and OTEL_PYTHON_ID_GENERATOR to ensure good compatibility with X-Ray and + Application Signals. Also applies patches to upstream instrumentation - usually these are stopgap measures until we can contribute long-term changes to upstream. kwargs: apply_patches: bool - apply patches to upstream instrumentation. Default is True. - - TODO: - 1. OTLPMetricExporterMixin is using hard coded histogram_aggregation_type, which reads - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION environment variable. Need to work with upstream to - make it to be configurable. """ # Issue: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2495 @@ -61,9 +52,6 @@ def _configure(self, **kwargs): os.environ.setdefault(OTEL_PROPAGATORS, "xray,tracecontext,b3,b3multi") os.environ.setdefault(OTEL_PYTHON_ID_GENERATOR, "xray") - os.environ.setdefault( - OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION, "base2_exponential_bucket_histogram" - ) if kwargs.get("apply_patches", True): apply_instrumentation_patches() diff --git a/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py b/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py index 62d1cc380..c43ce2f04 100644 --- a/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py +++ b/aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_opentelementry_configurator.py @@ -295,9 +295,6 @@ def validate_distro_environ(): # Set by AwsOpenTelemetryDistro tc.assertEqual("http/protobuf", os.environ.get("OTEL_EXPORTER_OTLP_PROTOCOL")) - tc.assertEqual( - "base2_exponential_bucket_histogram", os.environ.get("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION") - ) tc.assertEqual("xray,tracecontext,b3,b3multi", os.environ.get("OTEL_PROPAGATORS")) tc.assertEqual("xray", os.environ.get("OTEL_PYTHON_ID_GENERATOR"))