typelevel / natchez

functional tracing for cats
MIT License
322 stars 78 forks source link

Support for Associating Log Group Name with Trace in Natchez and AWS X-Ray Daemon #1018

Open ChristyGKrishnan opened 3 months ago

ChristyGKrishnan commented 3 months ago

We are using Natchez for generating traces for AWS X-Ray. X-Ray allows logs to be attached to the traces being generated, provided the CloudWatch log group name is included in the traces sent to X-Ray through the daemon. However, Natchez does not currently support passing this property along with traces, and neither does the AWS X-Ray Daemon.

In the screenshot below, the log section is empty even though the logs have the trace ID and entity ID present

Screenshot from 2024-05-24 14-51-42 In the image above image log section is empty even though the logs has trace id and entityId present in the logs.

If the trace includes the following details: "aws": { "cloudwatch_logs": [ { "log_group": "" } ] } then logs will appear as shown below: image

Proposed Solution: Introduce a mechanism in Natchez to include the CloudWatch log group name in the trace annotations. Specifically, if a field named aws_group_name is present in the annotations, it should be added as the AWS CloudWatch log group in the trace. have submitted a PR for the same. Steps to Reproduce

  1. Use Natchez to send X-Ray traces and use the X-Ray Daemon as the collector.
  2. Add trace and span details in the logs. 3.Verify if the CloudWatch logs are included with the trace.