|
1 | 1 | import type { AttributeValue, Span, TimeInput, Tracer } from '@opentelemetry/api'; |
| 2 | +import { SpanKind } from '@opentelemetry/api'; |
2 | 3 | // import { diag, DiagConsoleLogger } from '@opentelemetry/api'; |
3 | 4 | // import { DiagLogLevel } from '@opentelemetry/api/build/src/diag/types'; |
4 | 5 | import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; |
@@ -63,17 +64,23 @@ export class OpenTelemetryProvider implements TelemetryProvider { |
63 | 64 | } |
64 | 65 |
|
65 | 66 | sendEvent(name: string, data?: Record<string, AttributeValue>, startTime?: TimeInput, endTime?: TimeInput): void { |
66 | | - const span = this.tracer.startSpan(name, { startTime: startTime ?? Date.now() }); |
67 | | - span.setAttributes(this._globalAttributes); |
| 67 | + const span = this.tracer.startSpan(name, { |
| 68 | + attributes: this._globalAttributes, |
| 69 | + kind: SpanKind.INTERNAL, |
| 70 | + startTime: startTime ?? Date.now(), |
| 71 | + }); |
68 | 72 | if (data != null) { |
69 | 73 | span.setAttributes(data); |
70 | 74 | } |
71 | 75 | span.end(endTime); |
72 | 76 | } |
73 | 77 |
|
74 | 78 | startEvent(name: string, data?: Record<string, AttributeValue>, startTime?: TimeInput): Span { |
75 | | - const span = this.tracer.startSpan(name, { startTime: startTime ?? Date.now() }); |
76 | | - span.setAttributes(this._globalAttributes); |
| 79 | + const span = this.tracer.startSpan(name, { |
| 80 | + attributes: this._globalAttributes, |
| 81 | + kind: SpanKind.INTERNAL, |
| 82 | + startTime: startTime ?? Date.now(), |
| 83 | + }); |
77 | 84 | if (data != null) { |
78 | 85 | span.setAttributes(data); |
79 | 86 | } |
|
0 commit comments