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

[q] Inject Trace ID for a new trace from a context #1144

Closed
utrack opened this issue Sep 9, 2020 · 4 comments
Closed

[q] Inject Trace ID for a new trace from a context #1144

utrack opened this issue Sep 9, 2020 · 4 comments
Labels
question Further information is requested
Milestone

Comments

@utrack
Copy link

utrack commented Sep 9, 2020

Hi! Is there any way to give Tracer/IDGenerator a pre-generated ID for a new trace?

Here's what I'm trying to do:
I've got my service and its descendants that support upcoming W3C traceparent standard, and OTL plays along with them nicely.
But between me and clients, there's an nginx proxy w/o any OTL support.

nginx has a Request-ID which looks like trace ID though, so if a request comes to me I'd like to create a new trace w/o parent that has trace ID == Request-ID.
Is it possible to do that with the current API?


IDGenerator has a NewTraceID() that could be used for that if it accepted ctx as an argument.

I've also tried to create my own HTTPExtractor that works, but it has to generate fake span ID since there are no real parent spans to the trace. This won't work because it creates a dangling span w/o a parent.

@hairyhenderson
Copy link

Not a direct response to the question, but have you considered using the nginx-opentracing module? It supports zipkin-format trace propagation, which OTel can also support, so while it doesn't help with propagating the W3C headers, it'll at least let you propagate traces...

@hairyhenderson
Copy link

Also worth noting that there is an open issue in nginx-opentracing to support the w3c header: opentracing-contrib/nginx-opentracing#132

@MrAlias MrAlias added the question Further information is requested label Sep 22, 2020
@MrAlias
Copy link
Contributor

MrAlias commented Sep 22, 2020

Based on your description it sounds like you are trying to build a custom trace propagation scheme. To support this you would indeed want to take a look at the HTTPExtractor.

I've also tried to create my own HTTPExtractor that works, but it has to generate fake span ID since there are no real parent spans to the trace. This won't work because it creates a dangling span w/o a parent.

That is going to always be the case based on the problem you described.

nginx has a Request-ID which looks like trace ID though, so if a request comes to me I'd like to create a new trace w/o parent ...

The recommendation @hairyhenderson made about using the B3 encoding to propagate traces sounds like a good alternative. Otherwise, you will need to reinvent-the-wheel to support a full tracing scheme.

@MrAlias
Copy link
Contributor

MrAlias commented Oct 1, 2020

Going to close as I think the question was answered. Please reopen if more needs to be addressed.

@MrAlias MrAlias closed this as completed Oct 1, 2020
@pellared pellared added this to the untracked milestone Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants