aws / aws-xray-daemon

The AWS X-Ray daemon listens for traffic on UDP port 2000, gathers raw segment data, and relays it to the AWS X-Ray API.
Apache License 2.0
190 stars 68 forks source link

Java auto-instrumentation agent not sending any segments to xray-daemon #155

Open rcooper85 opened 2 years ago

rcooper85 commented 2 years ago

I am running a simple Spring Boot Java microservice with the latest release of the xray-agent .jar. I have followed the documentation from here. My application runs as an ECS service, with the xray-daemon as a sidecar container. The service runs in a vpc with a public subnet.

I then deploy my Java application with the x-ray daemon (3.3.3) running as a sidecar in ECS. The xray daemon ECS container has UDP port 2000 set. I have also included AWS_REGION=eu-west-2.

I then send a few HTTP requests to my service which returns a response. However, there is nothing logged by the javaagent or the xray daemon that suggests any segments/traces have been generated. Nothing appears in X-Ray.

One thing I do see in the daemon logs is "[ERROR] Get instance id metadata failed: RequestError: send request failed" but then shortly after I do see "Starting proxy http server on 0.0.0.0:2000"

The only thing I see in my Java application logs, linked to the javaagent is:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/opt/xray-agent/disco/dicso-java-agent.jar=pluginPath=/opt/xray-agent/disco/disco-plugins
INFO: Reading X-Ray Agent config file at: file:/app.jar!/BOOT-INF/classes/xray-agent.json
com.amazonaws.xray.agent.runtime.config.XRaySDKConfiguration init

Both my Task and TaskExecution Roles have the AWSXRayFullAccess and AWSXRayDaemonWriteAccess policies applied.

willarmiros commented 2 years ago

Hi @rcooper85,

Please enable debug logging on your java application as described here to determine if the agent is properly creating segments. You can also make sure you've setup networking for your daemon container here.

If there is nothing immediately obvious that's wrong with your setup from the above steps, I would recommend that you also consider using the AWS Distro for OpenTelemetry Java Agent & Collector. You can follow these docs for the agent and collector to get started with them on ECS, and support auto-instrumenting several more libraries by doing so.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in next 7 days. Thank you for your contributions.