Skip to content

Commit f40264e

Browse files
committed
upgrade to otel sdk v2, cleanup
1 parent e99a59c commit f40264e

File tree

5 files changed

+23
-283
lines changed

5 files changed

+23
-283
lines changed

incubator/opentelemetry-sampler-aws-xray/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@
4444
"@opentelemetry/api": "^1.9.0"
4545
},
4646
"dependencies": {
47-
"@opentelemetry/core": "^1.26.0",
48-
"@opentelemetry/resources": "^1.10.0",
49-
"@opentelemetry/sdk-trace-base": "^1.26.0"
47+
"@opentelemetry/core": "^2.0.0",
48+
"@opentelemetry/resources": "^2.0.0",
49+
"@opentelemetry/sdk-trace-base": "^2.0.0",
50+
"@opentelemetry/semantic-conventions": "^1.27.0"
5051
},
5152
"devDependencies": {
5253
"@opentelemetry/api": "^1.9.0",
53-
"@opentelemetry/sdk-trace-node": "^1.26.0",
54+
"@opentelemetry/sdk-trace-node": "^2.0.0",
5455
"@types/mocha": "10.0.10",
5556
"@types/node": "18.18.14",
5657
"@types/sinon": "17.0.4",

incubator/opentelemetry-sampler-aws-xray/test/remote-sampler.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
1919
// SPDX-License-Identifier: Apache-2.0
2020

21-
import { Resource } from '@opentelemetry/resources';
21+
import { resourceFromAttributes, emptyResource } from '@opentelemetry/resources';
2222
import {
2323
SEMRESATTRS_CLOUD_PLATFORM,
2424
ATTR_SERVICE_NAME,
@@ -42,7 +42,7 @@ describe('AWSXRayRemoteSampler', () => {
4242

4343
it('testCreateRemoteSamplerWithEmptyResource', () => {
4444
sampler = new AWSXRayRemoteSampler({
45-
resource: Resource.EMPTY,
45+
resource: emptyResource(),
4646
});
4747

4848
expect((sampler as any)._root._root.rulePoller).not.toBeFalsy();
@@ -53,7 +53,7 @@ describe('AWSXRayRemoteSampler', () => {
5353
});
5454

5555
it('testCreateRemoteSamplerWithPopulatedResource', () => {
56-
const resource = new Resource({
56+
const resource = resourceFromAttributes({
5757
[ATTR_SERVICE_NAME]: 'test-service-name',
5858
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
5959
});
@@ -67,7 +67,7 @@ describe('AWSXRayRemoteSampler', () => {
6767
});
6868

6969
it('testCreateRemoteSamplerWithAllFieldsPopulated', () => {
70-
const resource = new Resource({
70+
const resource = resourceFromAttributes({
7171
[ATTR_SERVICE_NAME]: 'test-service-name',
7272
[SEMRESATTRS_CLOUD_PLATFORM]: 'test-cloud-platform',
7373
});
@@ -89,7 +89,7 @@ describe('AWSXRayRemoteSampler', () => {
8989

9090
it('toString()', () => {
9191
expect(
92-
new AWSXRayRemoteSampler({ resource: Resource.EMPTY }).toString()
92+
new AWSXRayRemoteSampler({ resource: emptyResource() }).toString()
9393
).toEqual(
9494
'AWSXRayRemoteSampler{root=ParentBased{root=_AWSXRayRemoteSampler{awsProxyEndpoint=http://localhost:2000, rulePollingIntervalMillis=300000}, remoteParentSampled=AlwaysOnSampler, remoteParentNotSampled=AlwaysOffSampler, localParentSampled=AlwaysOnSampler, localParentNotSampled=AlwaysOffSampler}'
9595
);
@@ -117,15 +117,15 @@ describe('_AWSXRayRemoteSampler', () => {
117117

118118
it('should make a POST request to the /GetSamplingRules endpoint upon initialization', async () => {
119119
sampler = new _AWSXRayRemoteSampler({
120-
resource: Resource.EMPTY,
120+
resource: emptyResource(),
121121
pollingInterval: pollingInterval,
122122
});
123123
sinon.assert.calledOnce(xrayClientSpy);
124124
});
125125

126126
it('should make 3 POST requests to the /GetSamplingRules endpoint after 3 intervals have passed', async () => {
127127
sampler = new _AWSXRayRemoteSampler({
128-
resource: Resource.EMPTY,
128+
resource: emptyResource(),
129129
pollingInterval: pollingInterval,
130130
});
131131
clock.tick(pollingInterval * 1000 + 5000);

0 commit comments

Comments
 (0)