Replies: 1 comment 2 replies
-
If you are using the latest version, the Pass context directly: const span = tracer.startSpan(spanName, {}, api.setSpan(api.context.active(), parent)) set context active: api.context.with(api.setSpan(api.context.active(), parent), () => {
const span = tracer.startSpan(spanName); // this span gets the parent from the active context automatically
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
We have setup some custom instrumentation for websockets to mimic a request/response lifecyle, and are trying to connect spans created on the front-end with spans created on the backend.
We have passed the span to the backend, and have access to the span context/traceId, etc. When we attempt to set the parent of the custom span we create on the backend, the two spans don't seem to get linked into a single trace:
I imagine one of the problems is the
parentSpan
has been serialized when sent through the websocket, and is a plain JS object, so setting the parent instartSpan
doesn't work as expected. Any pointers on how we can connect these two manually instrumented spans would be super helpful.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions