Skip to content

Commit 6f72fb9

Browse files
authored
refactor(exporter-zipkin): update semconv usage to ATTR_ exports (#5673)
1 parent ba50c08 commit 6f72fb9

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

packages/opentelemetry-exporter-zipkin/src/zipkin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
defaultStatusCodeTagName,
2929
defaultStatusErrorTagName,
3030
} from './transform';
31-
import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
31+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
3232
import { prepareGetHeaders } from './utils';
3333

3434
/**
@@ -74,7 +74,7 @@ export class ZipkinExporter implements SpanExporter {
7474
): void {
7575
const serviceName = String(
7676
this._serviceName ||
77-
spans[0].resource.attributes[SEMRESATTRS_SERVICE_NAME] ||
77+
spans[0].resource.attributes[ATTR_SERVICE_NAME] ||
7878
this.DEFAULT_SERVICE_NAME
7979
);
8080

@@ -147,8 +147,8 @@ export class ZipkinExporter implements SpanExporter {
147147
toZipkinSpan(
148148
span,
149149
String(
150-
span.attributes[SEMRESATTRS_SERVICE_NAME] ||
151-
span.resource.attributes[SEMRESATTRS_SERVICE_NAME] ||
150+
span.attributes[ATTR_SERVICE_NAME] ||
151+
span.resource.attributes[ATTR_SERVICE_NAME] ||
152152
serviceName
153153
),
154154
this._statusCodeTagName,

packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { Resource } from '@opentelemetry/resources';
2525
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
2626
import * as assert from 'assert';
27-
import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
27+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
2828
import {
2929
defaultStatusCodeTagName,
3030
defaultStatusErrorTagName,
@@ -37,7 +37,7 @@ import { VERSION } from '../../src/version';
3737

3838
const resource = {
3939
attributes: {
40-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
40+
[ATTR_SERVICE_NAME]: 'zipkin-test',
4141
cost: '112.12',
4242
service: 'ui',
4343
version: '1',
@@ -128,7 +128,7 @@ describe('transform', () => {
128128
tags: {
129129
key1: 'value1',
130130
key2: 'value2',
131-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
131+
[ATTR_SERVICE_NAME]: 'zipkin-test',
132132
cost: '112.12',
133133
service: 'ui',
134134
version: '1',
@@ -163,7 +163,7 @@ describe('transform', () => {
163163
name: span.name,
164164
parentId: undefined,
165165
tags: {
166-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
166+
[ATTR_SERVICE_NAME]: 'zipkin-test',
167167
cost: '112.12',
168168
service: 'ui',
169169
version: '1',
@@ -209,7 +209,7 @@ describe('transform', () => {
209209
name: span.name,
210210
parentId: span.parentSpanContext?.spanId,
211211
tags: {
212-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
212+
[ATTR_SERVICE_NAME]: 'zipkin-test',
213213
cost: '112.12',
214214
service: 'ui',
215215
version: '1',
@@ -241,7 +241,7 @@ describe('transform', () => {
241241
assert.deepStrictEqual(tags, {
242242
key1: 'value1',
243243
key2: 'value2',
244-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
244+
[ATTR_SERVICE_NAME]: 'zipkin-test',
245245
'telemetry.sdk.language': 'nodejs',
246246
'telemetry.sdk.name': 'opentelemetry',
247247
'telemetry.sdk.version': VERSION,
@@ -267,7 +267,7 @@ describe('transform', () => {
267267
assert.deepStrictEqual(tags, {
268268
key1: 'value1',
269269
key2: 'value2',
270-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
270+
[ATTR_SERVICE_NAME]: 'zipkin-test',
271271
'telemetry.sdk.language': 'nodejs',
272272
'telemetry.sdk.name': 'opentelemetry',
273273
'telemetry.sdk.version': VERSION,
@@ -294,7 +294,7 @@ describe('transform', () => {
294294
key1: 'value1',
295295
key2: 'value2',
296296
[defaultStatusCodeTagName]: 'ERROR',
297-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
297+
[ATTR_SERVICE_NAME]: 'zipkin-test',
298298
'telemetry.sdk.language': 'nodejs',
299299
'telemetry.sdk.name': 'opentelemetry',
300300
'telemetry.sdk.version': VERSION,
@@ -322,7 +322,7 @@ describe('transform', () => {
322322
key2: 'value2',
323323
[defaultStatusCodeTagName]: 'ERROR',
324324
[defaultStatusErrorTagName]: 'my-message',
325-
[SEMRESATTRS_SERVICE_NAME]: 'zipkin-test',
325+
[ATTR_SERVICE_NAME]: 'zipkin-test',
326326
'telemetry.sdk.language': 'nodejs',
327327
'telemetry.sdk.name': 'opentelemetry',
328328
'telemetry.sdk.version': VERSION,

packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
import { ZipkinExporter } from '../../src';
3131
import * as zipkinTypes from '../../src/types';
3232
import { TraceFlags } from '@opentelemetry/api';
33-
import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
33+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
3434

3535
const MICROS_PER_SECS = 1e6;
3636

@@ -396,7 +396,7 @@ describe('Zipkin Exporter - node', () => {
396396
},
397397
],
398398
resource: resourceFromAttributes({
399-
[SEMRESATTRS_SERVICE_NAME]: resource_service_name,
399+
[ATTR_SERVICE_NAME]: resource_service_name,
400400
}),
401401
instrumentationScope: { name: 'default', version: '0.0.1' },
402402
droppedAttributesCount: 0,
@@ -422,7 +422,7 @@ describe('Zipkin Exporter - node', () => {
422422
links: [],
423423
events: [],
424424
resource: resourceFromAttributes({
425-
[SEMRESATTRS_SERVICE_NAME]: resource_service_name_prime,
425+
[ATTR_SERVICE_NAME]: resource_service_name_prime,
426426
}),
427427
instrumentationScope: { name: 'default', version: '0.0.1' },
428428
droppedAttributesCount: 0,
@@ -485,7 +485,7 @@ describe('Zipkin Exporter - node', () => {
485485
attributes: {
486486
key1: 'value1',
487487
key2: 'value2',
488-
[SEMRESATTRS_SERVICE_NAME]: span_service_name,
488+
[ATTR_SERVICE_NAME]: span_service_name,
489489
},
490490
links: [],
491491
events: [
@@ -517,7 +517,7 @@ describe('Zipkin Exporter - node', () => {
517517
code: api.SpanStatusCode.OK,
518518
},
519519
attributes: {
520-
[SEMRESATTRS_SERVICE_NAME]: span_service_name_prime,
520+
[ATTR_SERVICE_NAME]: span_service_name_prime,
521521
},
522522
links: [],
523523
events: [],

0 commit comments

Comments
 (0)