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

Links between Spans from different Traces #1279

Closed
sirzooro opened this issue Mar 22, 2022 · 5 comments
Closed

Links between Spans from different Traces #1279

sirzooro opened this issue Mar 22, 2022 · 5 comments

Comments

@sirzooro
Copy link

I have three applications: A, B and C. App C is 3rd-party for us (we cannot modify it). App B works as a gateway to app C - it contains only logic needed to establish connection with app C and pass packets in both directions.

When A sends something to B, it creates new Trace and passed it to B. The same when B sends something to A. However we are not able to to pass trace context to C and get it back. App B only examines data in packet header and is not able to link response to request sent earlier - this needs access to packet data, which is processed by app A only.

Is your feature request related to a problem?
I would like to be able to create link between Spans from two different Traces. According to specification this should be possible. However current C++ Tracing API allows to create link to parent Span only.

Describe the solution you'd like
Please add new method (e.g. AddLink) to Span class. Ability to add it via StartSpanOptions during Span creation time also may be handy.

Describe alternatives you've considered
At this moment we can only add attribute with ID of request's trace, or our custom app-specific ID. This allows to find related trace during debugging with extra manual steps.

@lalitb
Copy link
Member

lalitb commented Mar 23, 2022

However current C++ Tracing API allows to create link to parent Span only.

Tracer::StartSpan provides option to link unrelated spans. Let us know if this is what you are looking for ?

@sirzooro
Copy link
Author

Thanks for hint. This partially solves my case. Main issue with this approach is that I do not know target Trace for link when I create my Span. I would have to either create extra child Span later in order to put link there, or delay Span creation until link target is known. Both workaround have their downsides.

BTW, please create some example how to create links. It is not obvious that StartSpan method requires something like { { otherSpan->GetContext(), {} } } for links.

@lalitb
Copy link
Member

lalitb commented Mar 25, 2022

Thanks for hint. This partially solves my case. Main issue with this approach is that I do not know target Trace for link when I create my Span. I would have to either create extra child Span later in order to put link there, or delay Span creation until link target is known. Both workaround have their downsides.

Valid points. There are also downsides in allowing the linking of spans after span creation, more discussed here. AS of now, specs don't allow it, thought it can change in the future.

BTW, please create some example how to create links. It is not obvious that StartSpan method requires something like { { otherSpan->GetContext(), {} } } for links.

There are few examples in unit-tests here, but they are not realistic and can be improved. WIll add few examples.

@sirzooro
Copy link
Author

Thanks for hint. This partially solves my case. Main issue with this approach is that I do not know target Trace for link when I create my Span. I would have to either create extra child Span later in order to put link there, or delay Span creation until link target is known. Both workaround have their downsides.

Valid points. There are also downsides in allowing the linking of spans after span creation, more discussed here. AS of now, specs don't allow it, thought it can change in the future.

OK, I see. I thought that links are simply specialized kind of attributes, but it turns out that there is more logic associated with them. So I will use one of workarounds mentioned earlier.

@lalitb
Copy link
Member

lalitb commented Apr 2, 2022

Closing as discussed above. Please reopen if there are any further issues.

@lalitb lalitb closed this as completed Apr 2, 2022
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

No branches or pull requests

2 participants