Skip to content

Pin OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf#62

Merged
prim-8 merged 1 commit into
mainfrom
fix/otel-default-http-protocol
Apr 29, 2026
Merged

Pin OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf#62
prim-8 merged 1 commit into
mainfrom
fix/otel-default-http-protocol

Conversation

@prim-8
Copy link
Copy Markdown
Contributor

@prim-8 prim-8 commented Apr 29, 2026

Summary

opentelemetry-instrument defaults OTLP exporter protocol to grpc per the OTel spec, but the Dockerfile installs only the HTTP exporter. Without an explicit pin, runtime startup fails with:

RuntimeError: Requested component 'otlp_proto_grpc' not found
in entry point 'opentelemetry_traces_exporter'
Failed to auto initialize OpenTelemetry

The SDK then doesn't initialise — manual span calls become no-ops, the milter looks healthy, but no traces ship. Setting OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf (with :- so a deployer can still override) selects the right exporter.

Verified

docker build --build-arg INSTALL_DDTRACE=true --build-arg INSTALL_OTEL=true -t test .
docker run --rm \
  -e OTEL_TRACING_ENABLED=true \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
  -e OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
  test opentelemetry-instrument python3 -c '...'
# → SDK initialises, span created, exits 0
# → URLLib3Instrumentor / BotocoreInstrumentor / LoggingInstrumentor all attach

Test plan

  • Build with INSTALL_OTEL=true and run opentelemetry-instrument — no otlp_proto_grpc not found error.
  • Startup log shows OpenTelemetry tracing enabled (... protocol=http/protobuf).

…d exporter

The Dockerfile installs only the HTTP variant of the OTLP exporter
(opentelemetry-exporter-otlp-proto-http), but opentelemetry-instrument
defaults the protocol to grpc per the OTel spec. Without this pin
the wrapper fails at startup:

    RuntimeError: Requested component 'otlp_proto_grpc' not found
    in entry point 'opentelemetry_traces_exporter'
    Failed to auto initialize OpenTelemetry

The OTel SDK then doesn't initialise — manual span calls succeed
silently as no-ops, so the milter looks healthy but no traces ship.

Verified locally: docker build + docker run with
`opentelemetry-instrument python3 -c '...'` now starts cleanly
with the protocol pin; the three auto-instrumentations attach as
expected.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR fixes a runtime startup failure when OTEL_TRACING_ENABLED=true by pinning OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf in entrypoint.sh. The Dockerfile only installs opentelemetry-exporter-otlp-proto-http, but the OTel SDK defaults to gRPC, causing an unresolved entry-point error that silently drops all traces. The fix uses :- parameter expansion so deployers can still override the protocol, and adds the protocol to the startup log line for better observability.

Confidence Score: 5/5

Safe to merge — fixes a definite runtime failure with no regressions; all findings are P2 or lower.

The change is minimal, well-commented, and directly fixes a documented startup error. The :- default pattern preserves backward compatibility for deployers who want to override the protocol. Dockerfile confirms only the HTTP exporter is installed, validating the fix. No logic issues found.

No files require special attention.

Important Files Changed

Filename Overview
milter/entrypoint.sh Adds OTEL_EXPORTER_OTLP_PROTOCOL default (http/protobuf) and includes protocol in the startup log; fixes silent trace-drop when only the HTTP OTLP exporter is installed.

Sequence Diagram

sequenceDiagram
    participant E as entrypoint.sh
    participant SDK as opentelemetry-instrument
    participant Exp as OTLP HTTP Exporter

    E->>E: OTEL_TRACING_ENABLED=true
    E->>E: export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf (default)
    E->>SDK: exec opentelemetry-instrument python3 milter.py
    SDK->>SDK: reads OTEL_EXPORTER_OTLP_PROTOCOL
    SDK->>Exp: loads opentelemetry-exporter-otlp-proto-http
    Exp-->>SDK: exporter ready
    SDK-->>E: process starts, traces ship to OTLP endpoint
Loading

Reviews (1): Last reviewed commit: "OTel: pin OTEL_EXPORTER_OTLP_PROTOCOL=ht..." | Re-trigger Greptile

@prim-8 prim-8 merged commit 92a7fea into main Apr 29, 2026
8 checks passed
@prim-8 prim-8 deleted the fix/otel-default-http-protocol branch April 29, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant