* In preparation for the next major of OpenTelemetry, we want to support * looking up the parent span id according to the new API * In OTel v1, the parent span id is accessed as `parentSpanId` * In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
(span: OpenTelemetrySdkTraceBaseSpan)
| 256 | * In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext` |
| 257 | */ |
| 258 | function getOtelParentSpanId(span: OpenTelemetrySdkTraceBaseSpan): string | undefined { |
| 259 | return 'parentSpanId' in span |
| 260 | ? span.parentSpanId |
| 261 | : 'parentSpanContext' in span |
| 262 | ? (span.parentSpanContext as { spanId?: string } | undefined)?.spanId |
| 263 | : undefined; |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Converts a {@link StreamedSpanJSON} to a {@link SerializedSpan}. |
no outgoing calls
no test coverage detected