@@ -19,6 +19,7 @@ import expect from 'expect';
1919import * as sinon from 'sinon' ;
2020import { AlwaysRecordSampler } from '../src/always-record-sampler' ;
2121import { AttributePropagatingSpanProcessor } from '../src/attribute-propagating-span-processor' ;
22+ import { AwsBatchUnsampledSpanProcessor } from '../src/aws-batch-unsampled-span-processor' ;
2223import { AwsMetricAttributesSpanExporter } from '../src/aws-metric-attributes-span-exporter' ;
2324import {
2425 ApplicationSignalsExporterProvider ,
@@ -27,12 +28,11 @@ import {
2728 customBuildSamplerFromEnv ,
2829} from '../src/aws-opentelemetry-configurator' ;
2930import { AwsSpanMetricsProcessor } from '../src/aws-span-metrics-processor' ;
31+ import { OTLPUdpSpanExporter } from '../src/otlp-udp-exporter' ;
3032import { setAwsDefaultEnvironmentVariables } from '../src/register' ;
3133import { AwsXRayRemoteSampler } from '../src/sampler/aws-xray-remote-sampler' ;
3234import { AwsXraySamplingClient } from '../src/sampler/aws-xray-sampling-client' ;
3335import { GetSamplingRulesResponse } from '../src/sampler/remote-sampler.types' ;
34- import { OTLPUdpSpanExporter } from '../src/otlp-udp-exporter' ;
35- import { AwsBatchUnsampledSpanProcessor } from '../src/aws-batch-unsampled-span-processor' ;
3636
3737// Tests AwsOpenTelemetryConfigurator after running Environment Variable setup in register.ts
3838describe ( 'AwsOpenTelemetryConfiguratorTest' , ( ) => {
@@ -73,6 +73,7 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
7373 const startTimeSec : number = Math . floor ( new Date ( ) . getTime ( ) / 1000.0 ) ;
7474 const span : Span = tracer . startSpan ( 'test' ) ;
7575 const traceId : string = span . spanContext ( ) . traceId ;
76+ span . end ( ) ;
7677 const traceId4ByteHex : string = traceId . substring ( 0 , 8 ) ;
7778 const traceId4ByteNumber : number = Number ( `0x${ traceId4ByteHex } ` ) ;
7879 expect ( traceId4ByteNumber ) . toBeGreaterThanOrEqual ( startTimeSec ) ;
@@ -118,11 +119,11 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
118119 const sampler = customBuildSamplerFromEnv ( Resource . empty ( ) ) ;
119120
120121 expect ( sampler ) . toBeInstanceOf ( AwsXRayRemoteSampler ) ;
121- expect ( ( sampler as any ) . awsProxyEndpoint ) . toEqual ( 'http://localhost:2000' ) ;
122- expect ( ( sampler as any ) . rulePollingIntervalMillis ) . toEqual ( 300000 ) ; // ms
122+ expect ( ( sampler as any ) . _root . _root . awsProxyEndpoint ) . toEqual ( 'http://localhost:2000' ) ;
123+ expect ( ( sampler as any ) . _root . _root . rulePollingIntervalMillis ) . toEqual ( 300000 ) ; // ms
123124
124- clearInterval ( ( sampler as any ) . rulePoller ) ;
125- clearInterval ( ( sampler as any ) . targetPoller ) ;
125+ clearInterval ( ( sampler as any ) . _root . _root . rulePoller ) ;
126+ clearInterval ( ( sampler as any ) . _root . _root . targetPoller ) ;
126127 } ) ;
127128
128129 it ( 'ImportXRaySamplerWhenSamplerArgsSet' , ( ) => {
@@ -133,17 +134,17 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
133134 const sampler = customBuildSamplerFromEnv ( Resource . empty ( ) ) ;
134135
135136 expect ( sampler ) . toBeInstanceOf ( AwsXRayRemoteSampler ) ;
136- expect ( ( sampler as any ) . awsProxyEndpoint ) . toEqual ( 'http://asdfghjkl:2000' ) ;
137- expect ( ( sampler as any ) . rulePollingIntervalMillis ) . toEqual ( 600000 ) ; // ms
138- expect ( ( ( sampler as any ) . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
137+ expect ( ( sampler as any ) . _root . _root . awsProxyEndpoint ) . toEqual ( 'http://asdfghjkl:2000' ) ;
138+ expect ( ( sampler as any ) . _root . _root . rulePollingIntervalMillis ) . toEqual ( 600000 ) ; // ms
139+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
139140 'http://asdfghjkl:2000/GetSamplingRules'
140141 ) ;
141- expect ( ( ( sampler as any ) . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
142+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
142143 'http://asdfghjkl:2000/SamplingTargets'
143144 ) ;
144145
145- clearInterval ( ( sampler as any ) . rulePoller ) ;
146- clearInterval ( ( sampler as any ) . targetPoller ) ;
146+ clearInterval ( ( sampler as any ) . _root . _root . rulePoller ) ;
147+ clearInterval ( ( sampler as any ) . _root . _root . targetPoller ) ;
147148 } ) ;
148149
149150 it ( 'ImportXRaySamplerWithInvalidPollingIntervalSet' , ( ) => {
@@ -156,17 +157,17 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
156157 const sampler = customBuildSamplerFromEnv ( Resource . empty ( ) ) ;
157158
158159 expect ( sampler ) . toBeInstanceOf ( AwsXRayRemoteSampler ) ;
159- expect ( ( sampler as any ) . awsProxyEndpoint ) . toEqual ( 'http://asdfghjkl:2000' ) ;
160- expect ( ( sampler as any ) . rulePollingIntervalMillis ) . toEqual ( 300000 ) ; // default value
161- expect ( ( ( sampler as any ) . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
160+ expect ( ( sampler as any ) . _root . _root . awsProxyEndpoint ) . toEqual ( 'http://asdfghjkl:2000' ) ;
161+ expect ( ( sampler as any ) . _root . _root . rulePollingIntervalMillis ) . toEqual ( 300000 ) ; // default value
162+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
162163 'http://asdfghjkl:2000/GetSamplingRules'
163164 ) ;
164- expect ( ( ( sampler as any ) . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
165+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
165166 'http://asdfghjkl:2000/SamplingTargets'
166167 ) ;
167168
168- clearInterval ( ( sampler as any ) . rulePoller ) ;
169- clearInterval ( ( sampler as any ) . targetPoller ) ;
169+ clearInterval ( ( sampler as any ) . _root . _root . rulePoller ) ;
170+ clearInterval ( ( sampler as any ) . _root . _root . targetPoller ) ;
170171 } ) ;
171172
172173 // test_import_xray_sampler_with_invalid_environment_arguments
@@ -188,12 +189,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
188189 let sampler = customBuildSamplerFromEnv ( Resource . empty ( ) ) ;
189190
190191 expect ( sampler ) . toBeInstanceOf ( AwsXRayRemoteSampler ) ;
191- expect ( ( sampler as any ) . awsProxyEndpoint ) . toEqual ( 'http://lo=cal=host=:2000' ) ;
192- expect ( ( sampler as any ) . rulePollingIntervalMillis ) . toEqual ( 600000 ) ;
193- expect ( ( ( sampler as any ) . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
192+ expect ( ( sampler as any ) . _root . _root . awsProxyEndpoint ) . toEqual ( 'http://lo=cal=host=:2000' ) ;
193+ expect ( ( sampler as any ) . _root . _root . rulePollingIntervalMillis ) . toEqual ( 600000 ) ;
194+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
194195 'http://lo=cal=host=:2000/GetSamplingRules'
195196 ) ;
196- expect ( ( ( sampler as any ) . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
197+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
197198 'http://lo=cal=host=:2000/SamplingTargets'
198199 ) ;
199200
@@ -202,12 +203,12 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
202203 sampler = customBuildSamplerFromEnv ( Resource . empty ( ) ) ;
203204
204205 expect ( sampler ) . toBeInstanceOf ( AwsXRayRemoteSampler ) ;
205- expect ( ( sampler as any ) . awsProxyEndpoint ) . toEqual ( 'http://localhost:2000' ) ;
206- expect ( ( sampler as any ) . rulePollingIntervalMillis ) . toEqual ( 550000 ) ;
207- expect ( ( ( sampler as any ) . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
206+ expect ( ( sampler as any ) . _root . _root . awsProxyEndpoint ) . toEqual ( 'http://localhost:2000' ) ;
207+ expect ( ( sampler as any ) . _root . _root . rulePollingIntervalMillis ) . toEqual ( 550000 ) ;
208+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . getSamplingRulesEndpoint ) . toEqual (
208209 'http://localhost:2000/GetSamplingRules'
209210 ) ;
210- expect ( ( ( sampler as any ) . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
211+ expect ( ( ( sampler as any ) . _root . _root . samplingClient as any ) . samplingTargetsEndpoint ) . toEqual (
211212 'http://localhost:2000/SamplingTargets'
212213 ) ;
213214
0 commit comments