From 6dad43f003ddb0e70df9f71c74e5bbb0854c8bf8 Mon Sep 17 00:00:00 2001 From: Johannes Huster <66320475+JohannesHuster@users.noreply.github.com> Date: Sat, 1 Jun 2024 18:07:24 +0200 Subject: [PATCH] refactor(shim-opentracing): Use tree-shakeable string constants for semconv --- packages/opentelemetry-shim-opentracing/src/shim.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 8b4ecd1bf68..8c4b209c121 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -22,7 +22,11 @@ import { TextMapPropagator, } from '@opentelemetry/api'; import * as opentracing from 'opentracing'; -import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; +import { + SEMATTRS_EXCEPTION_MESSAGE, + SEMATTRS_EXCEPTION_STACKTRACE, + SEMATTRS_EXCEPTION_TYPE, +} from '@opentelemetry/semantic-conventions'; function translateReferences(references: opentracing.Reference[]): api.Link[] { const links: api.Link[] = []; @@ -325,15 +329,15 @@ export class SpanShim extends opentracing.Span { for (const [k, v] of entries) { switch (k) { case 'error.kind': { - mappedAttributes[SemanticAttributes.EXCEPTION_TYPE] = v; + mappedAttributes[SEMATTRS_EXCEPTION_TYPE] = v; break; } case 'message': { - mappedAttributes[SemanticAttributes.EXCEPTION_MESSAGE] = v; + mappedAttributes[SEMATTRS_EXCEPTION_MESSAGE] = v; break; } case 'stack': { - mappedAttributes[SemanticAttributes.EXCEPTION_STACKTRACE] = v; + mappedAttributes[SEMATTRS_EXCEPTION_STACKTRACE] = v; break; } default: {