( links?: SpanLink[], )
| 123 | * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent. |
| 124 | */ |
| 125 | export function getStreamedSpanLinks( |
| 126 | links?: SpanLink[], |
| 127 | ): SpanLinkJSON<RawAttributes<Record<string, unknown>>>[] | undefined { |
| 128 | if (links?.length) { |
| 129 | return links.map(({ context: { spanId, traceId, traceFlags }, attributes }) => ({ |
| 130 | span_id: spanId, |
| 131 | trace_id: traceId, |
| 132 | sampled: traceFlags === TRACE_FLAG_SAMPLED, |
| 133 | attributes, |
| 134 | })); |
| 135 | } else { |
| 136 | return undefined; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Convert a span time input into a timestamp in seconds. |
no outgoing calls
no test coverage detected