open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client

Home Page:https://opentelemetry.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to determine Parent Span from a ReadableSpan, check if Parent Span is Remote?

jj22ee opened this issue · comments

I would like to determine if the parent span (if it exists) is Remote, given a ReadableSpan. This information is needed in my implementation of a SpanExporter's export function.

  • ReadableSpan is the only information provided when implementing the Export functionality of SpanExporter. (see ConsoleExporter)

In Python and Java, this is easy. We can get the parent span from the current span, then check the contex's isRemote value.

  • Python
  • Java
  • In .NET, we can get the Parent Activity (name for .NET span) from the current activity

However, in JS, the ReadableSpan span only provides the parent's Id:

If we are able to get a span given an Id, this would help, but I haven't found a way to get a span given a span Id in the OTel JavaScript APIs.

Is there a workaround, or can OTel JS be updated to be able to get the parent span context given a ReadableSpan?

  • This only affects the JavaScript OpenTelemetry library
  • This may affect other libraries, but I would like to get opinions here first

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.