Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

No way to add a Link to an already-created Span #124

Closed
Sushisource opened this issue Oct 1, 2021 · 2 comments
Closed

No way to add a Link to an already-created Span #124

Sushisource opened this issue Oct 1, 2021 · 2 comments

Comments

@Sushisource
Copy link

As far as I can tell the only (typescript safe) way to link spans is to pass the link when creating the span as here: https://open-telemetry.github.io/opentelemetry-js-api/interfaces/tracer.html#startspan

However, it's desirable in many situations to be able to associate spans after they are created. I couldn't find any way to do this.

I would expect to be able to do something like:

span.link(otherSpanContext)

If there's a way to do this already please let me know. I could contribute this if it makes sense

@srikanthccv
Copy link
Member

@Sushisource
Copy link
Author

@lonewolf3739 Wow, thanks. This seems like such a clear thing to want to do that I just assumed it was part of the spec. What's funny is this actually already works if you bypass TS and just manually insert the links into the span, but I can see how sampling etc complicates things.

Feel free to close this in lieu of the issues on the spec if desired

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

No branches or pull requests

4 participants