refactor(shim-opentracing): update semconv usage to ATTR_ exports (#5674)
This commit is contained in:
parent
c2c9399740
commit
ba50c08e12
|
|
@ -23,9 +23,9 @@ import {
|
|||
} from '@opentelemetry/api';
|
||||
import * as opentracing from 'opentracing';
|
||||
import {
|
||||
SEMATTRS_EXCEPTION_MESSAGE,
|
||||
SEMATTRS_EXCEPTION_STACKTRACE,
|
||||
SEMATTRS_EXCEPTION_TYPE,
|
||||
ATTR_EXCEPTION_MESSAGE,
|
||||
ATTR_EXCEPTION_STACKTRACE,
|
||||
ATTR_EXCEPTION_TYPE,
|
||||
} from '@opentelemetry/semantic-conventions';
|
||||
|
||||
function translateReferences(references: opentracing.Reference[]): api.Link[] {
|
||||
|
|
@ -329,15 +329,15 @@ export class SpanShim extends opentracing.Span {
|
|||
for (const [k, v] of entries) {
|
||||
switch (k) {
|
||||
case 'error.kind': {
|
||||
mappedAttributes[SEMATTRS_EXCEPTION_TYPE] = v;
|
||||
mappedAttributes[ATTR_EXCEPTION_TYPE] = v;
|
||||
break;
|
||||
}
|
||||
case 'message': {
|
||||
mappedAttributes[SEMATTRS_EXCEPTION_MESSAGE] = v;
|
||||
mappedAttributes[ATTR_EXCEPTION_MESSAGE] = v;
|
||||
break;
|
||||
}
|
||||
case 'stack': {
|
||||
mappedAttributes[SEMATTRS_EXCEPTION_STACKTRACE] = v;
|
||||
mappedAttributes[ATTR_EXCEPTION_STACKTRACE] = v;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ import { performance } from 'perf_hooks';
|
|||
import { B3Propagator } from '@opentelemetry/propagator-b3';
|
||||
import { JaegerPropagator } from '@opentelemetry/propagator-jaeger';
|
||||
import {
|
||||
SEMATTRS_EXCEPTION_MESSAGE,
|
||||
SEMATTRS_EXCEPTION_STACKTRACE,
|
||||
SEMATTRS_EXCEPTION_TYPE,
|
||||
ATTR_EXCEPTION_MESSAGE,
|
||||
ATTR_EXCEPTION_STACKTRACE,
|
||||
ATTR_EXCEPTION_TYPE,
|
||||
} from '@opentelemetry/semantic-conventions';
|
||||
|
||||
describe('OpenTracing Shim', () => {
|
||||
|
|
@ -382,7 +382,7 @@ describe('OpenTracing Shim', () => {
|
|||
span.logEvent('error', payload);
|
||||
assert.strictEqual(otSpan.events[0].name, 'exception');
|
||||
const expectedAttributes = {
|
||||
[SEMATTRS_EXCEPTION_MESSAGE]: 'boom',
|
||||
[ATTR_EXCEPTION_MESSAGE]: 'boom',
|
||||
};
|
||||
assert.deepStrictEqual(
|
||||
otSpan.events[0].attributes,
|
||||
|
|
@ -401,9 +401,9 @@ describe('OpenTracing Shim', () => {
|
|||
assert.strictEqual(otSpan.events[0].name, 'exception');
|
||||
const expectedAttributes = {
|
||||
fault: 'meow',
|
||||
[SEMATTRS_EXCEPTION_TYPE]: 'boom',
|
||||
[SEMATTRS_EXCEPTION_MESSAGE]: 'oh no!',
|
||||
[SEMATTRS_EXCEPTION_STACKTRACE]: 'pancakes',
|
||||
[ATTR_EXCEPTION_TYPE]: 'boom',
|
||||
[ATTR_EXCEPTION_MESSAGE]: 'oh no!',
|
||||
[ATTR_EXCEPTION_STACKTRACE]: 'pancakes',
|
||||
};
|
||||
assert.deepStrictEqual(
|
||||
otSpan.events[0].attributes,
|
||||
|
|
@ -450,7 +450,7 @@ describe('OpenTracing Shim', () => {
|
|||
Math.trunc(tomorrow / 1000)
|
||||
);
|
||||
const expectedAttributes = {
|
||||
[SEMATTRS_EXCEPTION_MESSAGE]: 'boom',
|
||||
[ATTR_EXCEPTION_MESSAGE]: 'boom',
|
||||
};
|
||||
assert.deepStrictEqual(
|
||||
otSpan.events[0].attributes,
|
||||
|
|
@ -475,9 +475,9 @@ describe('OpenTracing Shim', () => {
|
|||
const expectedAttributes = {
|
||||
event: 'error',
|
||||
fault: 'meow',
|
||||
[SEMATTRS_EXCEPTION_TYPE]: 'boom',
|
||||
[SEMATTRS_EXCEPTION_MESSAGE]: 'oh no!',
|
||||
[SEMATTRS_EXCEPTION_STACKTRACE]: 'pancakes',
|
||||
[ATTR_EXCEPTION_TYPE]: 'boom',
|
||||
[ATTR_EXCEPTION_MESSAGE]: 'oh no!',
|
||||
[ATTR_EXCEPTION_STACKTRACE]: 'pancakes',
|
||||
};
|
||||
assert.deepStrictEqual(
|
||||
otSpan.events[0].attributes,
|
||||
|
|
|
|||
Loading…
Reference in New Issue