1 Answer
- Newest
- Most votes
- Most comments
0
- You're Using the New Distributed Tracing Model (CloudWatch Spans)
- Traces are being delivered to the
/aws/spans
log group. This is the new format used by CloudWatch Observability (CWOT). - The
PutTraceSegments
API calls you're seeing in CloudTrail confirm delivery to this newer backend. - However, the X-Ray SDK/API (e.g.,
BatchGetTraces
,GetTraceSummaries
) is still tied to the legacy X-Ray service and data store, not/aws/spans
.
- BatchGetTraces Will Return Nothing
If your application or Lambda is instrumented with OpenTelemetry or CloudWatch native tracing, and spans are sent to /aws/spans
, they will not be queryable via X-Ray's BatchGetTraces or shown in the legacy X-Ray console.
Only traces stored in the legacy X-Ray segment store (i.e., via PutTraceSegments
in the X-Ray API, not CloudWatch Logs) will be retrievable via those APIs.
- How to Query Traces Now
- Use the CloudWatch console → Application Signals or Service Map → Traces tab
- Or query spans from the
/aws/spans
log group using CloudWatch Logs Insights
You can query spans like this:
fields @timestamp, traceId, serviceName, name | sort @timestamp desc | limit 20
- Recommendation
If you want BatchGetTraces
to work, you must configure your application to send traces to X-Ray, not CloudWatch. That typically involves using:
- The X-Ray SDK (not OpenTelemetry SDK)
- X-Ray daemon or embedded collector
PutTraceSegments
to X-Ray, not CloudWatch Logs
But if you're already using the new CloudWatch tracing model, it’s better to move entirely to CloudWatch ServiceLens and OpenTelemetry and stop expecting X-Ray API compatibility.
Relevant content
- asked 3 years ago
- asked 2 years ago
- asked 3 years ago
- AWS OFFICIALUpdated 2 years ago