open-telemetry / open-telemetry/opentelemetry-java
AutoConfigure SDK doesn't behave in the same way as the java agent regarding OTLP protocol
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 58
Description
Describe the bug
For an application using the java agent, we can publish metrics using OTLP exporter with the following configurations:
OTEL_SERVICE_NAME="some-service-name"
OTEL_METRICS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_ENDPOINT="https://prometheus.mycompany.net/api/v1/otlp" # OTLP Receiver in Prometheus
OTEL_TRACES_EXPORTER=none
OTEL_LOGS_EXPORTER=none
For another application, using the AutoConfigure SDK, we face the following error:
io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: OTLP endpoint must not have a path: /api/v1/otlp
at io.opentelemetry.exporter.otlp.internal.OtlpConfigUtil.validateEndpoint(OtlpConfigUtil.java:375) ~[opentelemetry-exporter-otlp-1.42.1.jar:1.42.1]
It seems to assume gRPC by default, which doesn't allow a path. We have had to explicitly set OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf for it to work fine.
What did you expect to see?
I expected the same configuration to be needed if using the java agent or not.
What version and what artifacts are you using?
Artifacts: opentelemetry-api, opentelemetry-sdk-extension-autoconfigure, opentelemetry-exporter-otlp
Version: v1.42.1
How did you reference these artifacts? pom.xml with the Maven BOM
Environment
Compiler: 11
OS: CentOS Stream 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Java agent and AutoConfigure SDK handling of the OTLP endpoint and protocol environment variables. Reproduce the reported configuration with the OTLP endpoint path and inspect the OtlpConfigUtil validation described in the stack trace. Done means the same configuration behaves consistently in both setups without requiring an extra protocol setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100