Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Ensure traceID is propagated with Inject #200

Closed
willyyang opened this issue Nov 8, 2018 · 2 comments
Closed

Ensure traceID is propagated with Inject #200

willyyang opened this issue Nov 8, 2018 · 2 comments

Comments

@willyyang
Copy link

willyyang commented Nov 8, 2018

Hi, I'm hoping to understand whether I've injected the X-Datadog-Trace-Id of a span correctly in the carrier with the following code...

carrier := opentracing.HTTPHeadersCarrier(http.Header{})
mySpanContext := opentracing.SpanFromContext(ctx).Context()
opentracing.GlobalTracer().Inject(mySpanContext, opentracing.HTTPHeaders, carrier)

Can I be sure that the traceID of mySpanContext is the same as the one in carrier's X-Datadog-Trace-Id field?

I've extracted the headers from my other service and I see that two spans show up on DD with parent/child relationships.. can we assume that their traceIDs are the same and the X-Datadog-Parent-Id of the child span is the SpanID of the parent span?

Thanks in advance.

@yurishkuro
Copy link
Member

Whether it's datadog or whatever header is the question of which tracer implementation you're using.

Your code has one issue - you're creating an empty instance of http.Header{} which is thrown away. So nothing actually gets into the request. You need to use the headers associated with the request.

@willyyang
Copy link
Author

Thanks for the response. I'm using gRPC metadata to send the span's context across to another service.. just using Inject to get the traceID and parentID since #188 doesn't seem to be moving forward.

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

No branches or pull requests

2 participants