-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
AWS Cloudwatch Exporter: Logs not associated with X-Ray traces #24634
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This is the reason that the traces and logs can't be correlated. OpenTelemetry and X-Ray use different trace formats. The CoPilot docs on observability mention this and suggest that the application transforms the trace ID before it is logged (though this is probably not possible with auto-instrumentation). If you use the It's possible to add optional functionality to the CloudWatch Logs exporter to transform the trace ID into an X-Ray trace ID format but it brings up some questions. Should the exporter be transforming the data rather than a processor? Should the data be transformed in-place or added as a new field? The logs transformer processor is currently in development and should be able to do this type of transformation. |
My thoughts: Processors should be for domain specific transformations. This here, is a technical transformation, related to the exporter, so I would put it into the exporter, similar to how the awsxray exporter changes the OTEL spans into segments. Because the transformation of the trace ID should happen in the exporter, it could happen inline, although I would probably still leave the original field alone and add a new one, called |
I agree with you. We are facing the same problem as we are also using the xray exporter and the cloudwatch log exporter. I think the reason they don't play nice is because the xray exporter was developed by Amazon where as Cloudwatch log exporter was not and is not distributed in AWS OTel distro. Anyway, it would be nice for them to collaborate to align better. |
You may have already discovered this but in case this helps you. I managed to use a processor-transform to create a new "trace_id_xray" attribute using the string format of the trace_id based on the configuration file you shared. See relevant snippet below. Once I have the xray format of the trace id in the cloudwatch log, it is picked up and correlated with the xray trace.
|
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hi all, There are quite a few things that happen behind the scenes for trace to log correlation to happen correctly. I cannot speak to them all definitely but from what I understand the trace must have reference to the log group name in it's metadata and the cloudwatch log must have the traceid injected into it with this format Also, X-Ray no longer requires the timestamp in the trace id :) https://aws.amazon.com/about-aws/whats-new/2023/10/aws-x-ray-w3c-format-trace-ids-distributed-tracing/ |
That's awesome news |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
This issue has been closed as inactive because it has been stale for 120 days with no activity. |
Any updates here, I'm still facing this issue although i thought AWS cloudwatch and xray now support opentelemetry, Any thoughts? |
Component(s)
exporter/awscloudwatchlogs, exporter/awsxray
What happened?
Description
Logs exported with
awscloudwatchlogs
are not associated with their respective traces exported viaawsxray
.Steps to Reproduce
Create a span and while it's active, create a log entry. Export both to a local collector sidecar instance via OTLP exporter in the application. This local collector sidecar is configured to export logs with
awscloudwatchlogs
and traces vialoadbalancing
- via OTLP - to a gateway collector which in turn exports the traces viaawsxray
.Expected Result
When I open a trace in AWS X-Ray, I expect it to show the associated logs.
Actual Result
It doesn't show the logs in the Logs field of the trace. I can view the logs 'manually' by going to the log group and stream where they were exported to by
awscloudwatchlogs
When I click on "Show in Cloudwatch Insights" I notice two things:
I've tried to fix point 1 via
transform
, but it doesn't seem to be possible astrace_id
isn't a string and I found no way to convert it to a hex representation of the underlying byte array.Collector version
0.81.0
Environment information
Environment
AWS ECS Fargate
OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: