Skip to content

Commit

Permalink
refactor(shim-opentracing): Use tree-shakeable string constants for s…
Browse files Browse the repository at this point in the history
…emconv
  • Loading branch information
JohannesHuster committed Jun 1, 2024
1 parent ecc88a3 commit 6dad43f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/opentelemetry-shim-opentracing/src/shim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 6dad43f

Please sign in to comment.