Skip to content

NH-106956 OTLP exporter compression gzip by default #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions solarwinds_apm/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from opentelemetry.instrumentation.version import __version__ as inst_version
from opentelemetry.metrics import NoOpMeterProvider
from opentelemetry.sdk.environment_variables import (
OTEL_EXPORTER_OTLP_COMPRESSION,
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT,
OTEL_EXPORTER_OTLP_LOGS_HEADERS,
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL,
Expand Down Expand Up @@ -234,6 +235,8 @@ def _configure(self, **kwargs):
# Always opt into new semconv for all instrumentors (if supported)
environ["OTEL_SEMCONV_STABILITY_OPT_IN"] = self.get_semconv_opt_in()

environ.setdefault(OTEL_EXPORTER_OTLP_COMPRESSION, "gzip")

def load_instrumentor(self, entry_point: EntryPoint, **kwargs):
"""Takes a collection of instrumentation entry points
and activates them by instantiating and calling instrument()
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
OTEL_TRACES_EXPORTER
)
from opentelemetry.sdk.environment_variables import (
OTEL_EXPORTER_OTLP_COMPRESSION,
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT,
OTEL_EXPORTER_OTLP_LOGS_HEADERS,
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL,
Expand Down Expand Up @@ -485,6 +486,7 @@ def test_configure_no_env(self, mocker):
mocker.patch.dict(os.environ, {})
distro.SolarWindsDistro()._configure()
assert os.environ[OTEL_PROPAGATORS] == "tracecontext,baggage,solarwinds_propagator"
assert os.environ[OTEL_EXPORTER_OTLP_COMPRESSION] == "gzip"
assert os.environ[OTEL_TRACES_EXPORTER] == "solarwinds_exporter"
assert os.environ[OTEL_METRICS_EXPORTER] == "otlp_proto_http"
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp_proto_http"
Expand Down