-
Notifications
You must be signed in to change notification settings - Fork 132
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
Use OkHttp for xray sampling requests. #135
Conversation
For the instrumentation members that will probably read this I should mention that @wangzlei will file an issue with the stacktrace he is seeing in HTTPUrlConnection instrumentation, as applied to the sampler (I suspect it's a more broad-reaching corner case of some sort). |
Environment: Amazon EC2, Amazon Linux 2 amd64, OpenJDK 11. To be noted, the issue does not happen in Mac, though in Mac we see another issue #133 docker-compose.yml version: "3.6"
services:
otel:
image: otel/opentelemetry-collector-contrib:latest
command: --config /config/collector3.yml
volumes:
- /home/ec2-user:/config
environment:
AWS_REGION: us-west-2
ports:
- '4317:4317'
- '13133:13133'
- '2000:2000'
app:
image: myapp:latest
command: java -Dotel.javaagent.debug=true -javaagent:./aws-opentelemetry-agent.jar -jar ./build/libs/spring-boot-0.0.1-SNAPSHOT.jar Application
environment:
OTEL_SERVICE_NAME: MyEC2App
OTEL_TRACES_SAMPLER: xray
OTEL_TRACES_SAMPLER_ARG: 'endpoint=http://otel:2000'
OTEL_TRACES_EXPORTER: otlp
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel:4317
ports:
- '8080:8080'
depends_on:
- otel Collector config extensions:
awsproxy:
endpoint: 0.0.0.0:2000
receivers:
otlp:
protocols:
grpc:
exporters:
logging:
loglevel: debug
awsxray:
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging, awsxray]
extensions: [awsproxy]
telemetry:
logs:
level: "debug" XRay sampler fetches SamplingRules failed:
Collector error logs:
|
Now that OTLP exporters have migrated from the grpc library to okhttp and have a default dependency on it, there is no good reason to use HTTPUrlConnection here as almost all users will have okhttp on the classpath.
The objective of this PR is to use a more modern HTTP library. Coincidentally it will also remove spans generated for sampling requests which we wanted.
Fixes #133 (works around probably a bug in HTTPUrlConnection instrumentation in the javaagent)