Skip to content
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

Allow to manually provide trace id #104

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kfigiela
Copy link

Allow user to bypass trace id generator and provide it externally. The use case I have for this is the AWS XRay extractor running in ALB mode. As described below, we can't insert a parent span in our use case, as our upstream only provides a trace id, but does really implement tracing. To provide loose-coupling an external trace id can be provided via Context.

Use case

We're using this library to push traces to AWS X-Ray with the help of the forked library to accomodate trace id format that AWS uses. We are using AWS Load Balancer as the entry-point. AWS LB provides X-Amzn-Trace-Id that can be used for request tracing and has the format that XRay expects. It's very convenient to have a single correlation id that can be used across the whole system (load balancer access logs, X-Ray, application logs, etc). Having separate lookalike ids causes only confusion.

In a typical scenario, extractor would get trace id and parent span id. However, LB is not fully integrated with X-Ray – it does not communicate a trace to X-Ray. The header is also not in the expected format – only trace id is present with no span id (e.g. X-Amzn-Trace-Id: Root=1-63441c4a-abcdef012345678912345678). I have tried to deterministically generate span id based on trace id for the root span, this however caused only issues – since the root span has been never reported, X-Ray did not display traces correctly wrt. to timing or response statuses. That's why an external trace id is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant