diff --git a/packages/opentelemetry-node/src/spanprocessor.ts b/packages/opentelemetry-node/src/spanprocessor.ts index b96cc424fb0d..08d14e9fa671 100644 --- a/packages/opentelemetry-node/src/spanprocessor.ts +++ b/packages/opentelemetry-node/src/spanprocessor.ts @@ -1,5 +1,5 @@ import type { Context } from '@opentelemetry/api'; -import { trace } from '@opentelemetry/api'; +import { SpanKind, trace } from '@opentelemetry/api'; import type { Span as OtelSpan, SpanProcessor as OtelSpanProcessor } from '@opentelemetry/sdk-trace-base'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core'; @@ -223,7 +223,7 @@ function updateSpanWithOtelData(sentrySpan: SentrySpan, otelSpan: OtelSpan): voi const { attributes, kind } = otelSpan; sentrySpan.setStatus(mapOtelStatus(otelSpan)); - sentrySpan.setData('otel.kind', kind.valueOf()); + sentrySpan.setData('otel.kind', SpanKind[kind]); Object.keys(attributes).forEach(prop => { const value = attributes[prop]; diff --git a/packages/opentelemetry-node/test/spanprocessor.test.ts b/packages/opentelemetry-node/test/spanprocessor.test.ts index 27a72a1943d9..4e3c975d00cf 100644 --- a/packages/opentelemetry-node/test/spanprocessor.test.ts +++ b/packages/opentelemetry-node/test/spanprocessor.test.ts @@ -221,7 +221,7 @@ describe('SentrySpanProcessor', () => { child.end(); expect(sentrySpan?.data).toEqual({ - 'otel.kind': 0, + 'otel.kind': 'INTERNAL', 'test-attribute': 'test-value', 'test-attribute-2': [1, 2, 3], 'test-attribute-3': 0,