Skip to content

Commit 09d57b4

Browse files
authored
chore(sampler-aws-xray): update semconv usage to modern exports (#3076)
Refs: #2377
1 parent a19474f commit 09d57b4

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

packages/sampler-aws-xray/src/sampling-rule-applier.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {
3939
ATTR_URL_FULL,
4040
ATTR_URL_PATH,
4141
ATTR_SERVICE_NAME,
42-
SEMRESATTRS_FAAS_ID,
4342
} from '@opentelemetry/semantic-conventions';
4443
import {
4544
ATTR_HTTP_HOST,
@@ -260,7 +259,6 @@ export class SamplingRuleApplier {
260259
): AttributeValue | undefined {
261260
const arn: AttributeValue | undefined =
262261
resource?.attributes[ATTR_CLOUD_RESOURCE_ID] ||
263-
resource?.attributes[SEMRESATTRS_FAAS_ID] ||
264262
attributes[ATTR_AWS_LAMBDA_INVOKED_ARN];
265263
return arn;
266264
}

packages/sampler-aws-xray/test/remote-sampler.test.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ import {
3434
} from '@opentelemetry/api';
3535
import { SamplingDecision } from '@opentelemetry/sdk-trace-base';
3636
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
37-
import {
38-
SEMRESATTRS_CLOUD_PLATFORM,
39-
ATTR_SERVICE_NAME,
40-
} from '@opentelemetry/semantic-conventions';
37+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
4138
import { expect } from 'expect';
4239
import * as nock from 'nock';
4340
import * as sinon from 'sinon';
@@ -46,6 +43,7 @@ import {
4643
AWSXRayRemoteSampler,
4744
} from '../src/remote-sampler';
4845
import { AWSXRaySamplingClient } from '../src/aws-xray-sampling-client';
46+
import { ATTR_CLOUD_PLATFORM } from '../src/semconv';
4947

5048
const DATA_DIR_SAMPLING_RULES =
5149
__dirname + '/data/test-remote-sampler_sampling-rules-response-sample.json';
@@ -81,7 +79,7 @@ describe('AWSXRayRemoteSampler', () => {
8179
it('testCreateRemoteSamplerWithPopulatedResource', () => {
8280
const resource = resourceFromAttributes({
8381
[ATTR_SERVICE_NAME]: 'test-service-name',
84-
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
82+
[ATTR_CLOUD_PLATFORM]: 'test-cloud-platform',
8583
});
8684
sampler = new AWSXRayRemoteSampler({ resource: resource });
8785

@@ -100,7 +98,7 @@ describe('AWSXRayRemoteSampler', () => {
10098
it('testCreateRemoteSamplerWithAllFieldsPopulated', () => {
10199
const resource = resourceFromAttributes({
102100
[ATTR_SERVICE_NAME]: 'test-service-name',
103-
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
101+
[ATTR_CLOUD_PLATFORM]: 'test-cloud-platform',
104102
});
105103
sampler = new AWSXRayRemoteSampler({
106104
resource: resource,
@@ -132,7 +130,7 @@ describe('AWSXRayRemoteSampler', () => {
132130
.reply(200, require(DATA_DIR_SAMPLING_TARGETS));
133131
const resource = resourceFromAttributes({
134132
[ATTR_SERVICE_NAME]: 'test-service-name',
135-
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
133+
[ATTR_CLOUD_PLATFORM]: 'test-cloud-platform',
136134
});
137135

138136
sampler = new AWSXRayRemoteSampler({
@@ -203,7 +201,7 @@ describe('AWSXRayRemoteSampler', () => {
203201
.reply(200, require(DATA_DIR_SAMPLING_TARGETS));
204202
const resource = resourceFromAttributes({
205203
[ATTR_SERVICE_NAME]: 'test-service-name',
206-
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
204+
[ATTR_CLOUD_PLATFORM]: 'test-cloud-platform',
207205
});
208206
const attributes = { abc: '1234' };
209207

@@ -269,7 +267,7 @@ describe('AWSXRayRemoteSampler', () => {
269267
.reply(200, require(DATA_DIR_SAMPLING_TARGETS));
270268
const resource = resourceFromAttributes({
271269
[ATTR_SERVICE_NAME]: 'test-service-name',
272-
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
270+
[ATTR_CLOUD_PLATFORM]: 'test-cloud-platform',
273271
});
274272
const attributes = {
275273
abc: 'non-matching attribute value, use default rule',

0 commit comments

Comments
 (0)