Get span by id
#4158
-
Is it possible to get span by id? Say I get a span with: import { context, trace } from '@opentelemetry/api';
const currentSpan = trace.getSpan(context.active());
getSpanById(currentSpan.parentSpanId) |
Beta Was this translation helpful? Give feedback.
Answered by
Flarna
Sep 23, 2023
Replies: 1 comment 1 reply
-
That's not possible. The parent span could be already ended, exported and garbage collected. Or it could be a even on a different process if it was extracted from http headers. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ris314
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's not possible. The parent span could be already ended, exported and garbage collected. Or it could be a even on a different process if it was extracted from http headers.
Note that a span holds only the the span id of it's parent, not an actual reference to it.