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' ;
2222import {
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