(options: OpenTelemetrySpanContext)
| 194 | } |
| 195 | |
| 196 | function getSpanOptions(options: OpenTelemetrySpanContext): SpanOptions { |
| 197 | const { startTime, attributes, kind, op, links } = options; |
| 198 | |
| 199 | // OTEL expects timestamps in ms, not seconds |
| 200 | const fixedStartTime = typeof startTime === 'number' ? ensureTimestampInMilliseconds(startTime) : startTime; |
| 201 | |
| 202 | return { |
| 203 | attributes: op |
| 204 | ? { |
| 205 | [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op, |
| 206 | ...attributes, |
| 207 | } |
| 208 | : attributes, |
| 209 | kind, |
| 210 | links, |
| 211 | startTime: fixedStartTime, |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | function ensureTimestampInMilliseconds(timestamp: number): number { |
| 216 | const isMs = timestamp < 9999999999; |
no test coverage detected