Skip to content

Commit

Permalink
Remove OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION setti…
Browse files Browse the repository at this point in the history
…ng logic
  • Loading branch information
thpierce committed Jun 10, 2024
1 parent 5163f54 commit e975fd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand All @@ -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
Expand All @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down

0 comments on commit e975fd8

Please sign in to comment.