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

How to propagate span context from one autoinstrumented span into next. E.g. express instrumentation-http into instrumentation-nestjs-core? #4701

Closed
AkselAllas opened this issue May 13, 2024 · 2 comments
Labels
bug Something isn't working information-requested Bug is waiting on additional information from the user triage

Comments

@AkselAllas
Copy link
Contributor

AkselAllas commented May 13, 2024

What happened?

Steps to Reproduce

I am using trace.getActiveSpan() and propagating context into child spans.
But this isn't working for when autoinstrumented context switches.

I have this scenario:
image

Expected Result

I would need to be able to propagate context. Is baggage the only option here?

Actual Result

How can I propagate span context from one autoinstrumented span into next. E.g. express instrumentation-http into instrumentation-nestjs-core?

OpenTelemetry Setup Code

No response

package.json

No response

Relevant log output

No response

@AkselAllas AkselAllas added bug Something isn't working triage labels May 13, 2024
@dyladan
Copy link
Member

dyladan commented May 15, 2024

I'm not sure what you're asking here. Baggage and trace ids are propagated by context. I think you may be using hte term "context" in a way we don't normally use it. Can you please explain your use case a little further or provide a code example?

@dyladan dyladan added the information-requested Bug is waiting on additional information from the user label May 15, 2024
@AkselAllas
Copy link
Contributor Author

AkselAllas commented May 15, 2024

I solved this by removing instrumentation-nestjs-core.

Basically I have a custom startSpan function where I am doing trace.getActiveSpan() and getting attributes of "parent" span for propagation into new custom span.

Problem is that there is no interface for instrumentation-nestjs-core to also do this custom attribute propagation when it's autoinstrumented span is generated, thus stopping the chain. And I think baggage here wouldn't help much either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working information-requested Bug is waiting on additional information from the user triage
Projects
None yet
Development

No branches or pull requests

2 participants