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

support propagation of incoming requests #39

Open
LeTamanoir opened this issue Dec 7, 2024 · 1 comment
Open

support propagation of incoming requests #39

LeTamanoir opened this issue Dec 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@LeTamanoir
Copy link

What is the problem this feature would solve?

If I call an Elysia app from a another app that forwards a traceparent, elysia does not pick it up.

https://opentelemetry.io/docs/languages/js/propagation/#manual-context-propagation

What is the feature you are proposing to solve the problem?

Add support for incoming request propagation

What alternatives have you considered?

No response

@LeTamanoir LeTamanoir added the enhancement New feature or request label Dec 7, 2024
@LeTamanoir
Copy link
Author

LeTamanoir commented Dec 7, 2024

I believe to make this work this part of the code:

opentelemetry/src/index.ts

Lines 271 to 277 in c9f771c

tracer.startActiveSpan('request', (rootSpan) =>
otelContext.bind(
trace.setSpan(otelContext.active(), rootSpan),
fn
)
)
)
should be adapted to be able to receive the request headers, and create the context from the headers.

something like this:

import { propagation } from '@opentelemetry/api';

[...]

.wrap((fn, find_a_way_to_pass_headers_of_request) =>
  tracer.startActiveSpan('request', (rootSpan) =>
    otelContext.bind(
      trace.setSpan(propagation.extract(otelContext.active(), headers_of_request), rootSpan), fn
    )
  )
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant