Skip to content

Commit ba50c08

Browse files
authored
refactor(shim-opentracing): update semconv usage to ATTR_ exports (#5674)
1 parent c2c9399 commit ba50c08

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

packages/opentelemetry-shim-opentracing/src/shim.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
} from '@opentelemetry/api';
2424
import * as opentracing from 'opentracing';
2525
import {
26-
SEMATTRS_EXCEPTION_MESSAGE,
27-
SEMATTRS_EXCEPTION_STACKTRACE,
28-
SEMATTRS_EXCEPTION_TYPE,
26+
ATTR_EXCEPTION_MESSAGE,
27+
ATTR_EXCEPTION_STACKTRACE,
28+
ATTR_EXCEPTION_TYPE,
2929
} from '@opentelemetry/semantic-conventions';
3030

3131
function translateReferences(references: opentracing.Reference[]): api.Link[] {
@@ -329,15 +329,15 @@ export class SpanShim extends opentracing.Span {
329329
for (const [k, v] of entries) {
330330
switch (k) {
331331
case 'error.kind': {
332-
mappedAttributes[SEMATTRS_EXCEPTION_TYPE] = v;
332+
mappedAttributes[ATTR_EXCEPTION_TYPE] = v;
333333
break;
334334
}
335335
case 'message': {
336-
mappedAttributes[SEMATTRS_EXCEPTION_MESSAGE] = v;
336+
mappedAttributes[ATTR_EXCEPTION_MESSAGE] = v;
337337
break;
338338
}
339339
case 'stack': {
340-
mappedAttributes[SEMATTRS_EXCEPTION_STACKTRACE] = v;
340+
mappedAttributes[ATTR_EXCEPTION_STACKTRACE] = v;
341341
break;
342342
}
343343
default: {

packages/opentelemetry-shim-opentracing/test/Shim.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import { performance } from 'perf_hooks';
3737
import { B3Propagator } from '@opentelemetry/propagator-b3';
3838
import { JaegerPropagator } from '@opentelemetry/propagator-jaeger';
3939
import {
40-
SEMATTRS_EXCEPTION_MESSAGE,
41-
SEMATTRS_EXCEPTION_STACKTRACE,
42-
SEMATTRS_EXCEPTION_TYPE,
40+
ATTR_EXCEPTION_MESSAGE,
41+
ATTR_EXCEPTION_STACKTRACE,
42+
ATTR_EXCEPTION_TYPE,
4343
} from '@opentelemetry/semantic-conventions';
4444

4545
describe('OpenTracing Shim', () => {
@@ -382,7 +382,7 @@ describe('OpenTracing Shim', () => {
382382
span.logEvent('error', payload);
383383
assert.strictEqual(otSpan.events[0].name, 'exception');
384384
const expectedAttributes = {
385-
[SEMATTRS_EXCEPTION_MESSAGE]: 'boom',
385+
[ATTR_EXCEPTION_MESSAGE]: 'boom',
386386
};
387387
assert.deepStrictEqual(
388388
otSpan.events[0].attributes,
@@ -401,9 +401,9 @@ describe('OpenTracing Shim', () => {
401401
assert.strictEqual(otSpan.events[0].name, 'exception');
402402
const expectedAttributes = {
403403
fault: 'meow',
404-
[SEMATTRS_EXCEPTION_TYPE]: 'boom',
405-
[SEMATTRS_EXCEPTION_MESSAGE]: 'oh no!',
406-
[SEMATTRS_EXCEPTION_STACKTRACE]: 'pancakes',
404+
[ATTR_EXCEPTION_TYPE]: 'boom',
405+
[ATTR_EXCEPTION_MESSAGE]: 'oh no!',
406+
[ATTR_EXCEPTION_STACKTRACE]: 'pancakes',
407407
};
408408
assert.deepStrictEqual(
409409
otSpan.events[0].attributes,
@@ -450,7 +450,7 @@ describe('OpenTracing Shim', () => {
450450
Math.trunc(tomorrow / 1000)
451451
);
452452
const expectedAttributes = {
453-
[SEMATTRS_EXCEPTION_MESSAGE]: 'boom',
453+
[ATTR_EXCEPTION_MESSAGE]: 'boom',
454454
};
455455
assert.deepStrictEqual(
456456
otSpan.events[0].attributes,
@@ -475,9 +475,9 @@ describe('OpenTracing Shim', () => {
475475
const expectedAttributes = {
476476
event: 'error',
477477
fault: 'meow',
478-
[SEMATTRS_EXCEPTION_TYPE]: 'boom',
479-
[SEMATTRS_EXCEPTION_MESSAGE]: 'oh no!',
480-
[SEMATTRS_EXCEPTION_STACKTRACE]: 'pancakes',
478+
[ATTR_EXCEPTION_TYPE]: 'boom',
479+
[ATTR_EXCEPTION_MESSAGE]: 'oh no!',
480+
[ATTR_EXCEPTION_STACKTRACE]: 'pancakes',
481481
};
482482
assert.deepStrictEqual(
483483
otSpan.events[0].attributes,

0 commit comments

Comments
 (0)