OTEL_OTLP_ENDPOINT seems to get ignored
StiviiK opened this issue · comments
Describe the question
Hi there,
I am trying to instrument a Java 17 (Spring Boot) Application with the AWS-OTEL-COLLECTOR. I basically followed this two documentations:
Steps to reproduce if your question is related to an action
I have added the following configuration to my Dockerfile.
ADD --chown=nonroot:nonroot ${AWS_OTEL_SOURCE} /opt/aws-opentelemetry-agent.jar
ENV JAVA_TOOL_OPTIONS=-javaagent:/opt/aws-opentelemetry-agent.jar
ENV OTEL_OTLP_ENDPOINT "http://aws-otel-collector:4317"
ENV OTEL_RESOURCE_ATTRIBUTES "service.name=WFPBackend"
But it seems the running container is still trying to connect to http://localhost:4317
instead of my configured ENV OTEL_OTLP_ENDPOINT
.
It triesd to connect to http://localhost:4317
instead of http://aws-otel-collector:4317
.
Relevant log entry in my Spring Boot application:
[otel.javaagent 2024-03-27 13:50:13:846 +0000] [OkHttp http://localhost:4317/...] WARN io.opentelemetry.exporter.internal.grpc.GrpcExporter - Failed to export spans. Server responded with gRPC status code 2. Error message: Failed to connect to localhost/127.0.0.1:4317
Environment
- AWS ECS running on EC2 instances
- Task configured to use bridge mode
- Container links are setup within the container definition.
Fixed it. It seems like the ENV variable is called OTEL_EXPORTER_OTLP_ENDPOINT
.
See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/#otel_exporter_otlp_endpoint.