@@ -44,6 +44,7 @@ import {
4444} from '../../src' ;
4545import { SpanImpl } from '../../src/Span' ;
4646import { MultiSpanProcessor } from '../../src/MultiSpanProcessor' ;
47+ import { Tracer } from '../../src/Tracer' ;
4748
4849class DummyPropagator implements TextMapPropagator {
4950 inject ( context : Context , carrier : any , setter : TextMapSetter < any > ) : void {
@@ -137,7 +138,9 @@ describe('BasicTracerProvider', () => {
137138 describe ( 'generalLimits' , ( ) => {
138139 describe ( 'when not defined default values' , ( ) => {
139140 it ( 'should have tracer with default values' , ( ) => {
140- const tracer = new BasicTracerProvider ( { } ) . getTracer ( 'default' ) ;
141+ const tracer = new BasicTracerProvider ( { } ) . getTracer (
142+ 'default'
143+ ) as Tracer ;
141144 assert . deepStrictEqual ( tracer . getGeneralLimits ( ) , {
142145 attributeValueLengthLimit : Infinity ,
143146 attributeCountLimit : 128 ,
@@ -151,7 +154,7 @@ describe('BasicTracerProvider', () => {
151154 generalLimits : {
152155 attributeCountLimit : 100 ,
153156 } ,
154- } ) . getTracer ( 'default' ) ;
157+ } ) . getTracer ( 'default' ) as Tracer ;
155158 const generalLimits = tracer . getGeneralLimits ( ) ;
156159 assert . strictEqual ( generalLimits . attributeCountLimit , 100 ) ;
157160 } ) ;
@@ -163,7 +166,7 @@ describe('BasicTracerProvider', () => {
163166 generalLimits : {
164167 attributeValueLengthLimit : 10 ,
165168 } ,
166- } ) . getTracer ( 'default' ) ;
169+ } ) . getTracer ( 'default' ) as Tracer ;
167170 const generalLimits = tracer . getGeneralLimits ( ) ;
168171 assert . strictEqual ( generalLimits . attributeValueLengthLimit , 10 ) ;
169172 } ) ;
@@ -173,7 +176,7 @@ describe('BasicTracerProvider', () => {
173176 generalLimits : {
174177 attributeValueLengthLimit : - 10 ,
175178 } ,
176- } ) . getTracer ( 'default' ) ;
179+ } ) . getTracer ( 'default' ) as Tracer ;
177180 const generalLimits = tracer . getGeneralLimits ( ) ;
178181 assert . strictEqual ( generalLimits . attributeValueLengthLimit , - 10 ) ;
179182 } ) ;
@@ -183,7 +186,9 @@ describe('BasicTracerProvider', () => {
183186 describe ( 'spanLimits' , ( ) => {
184187 describe ( 'when not defined default values' , ( ) => {
185188 it ( 'should have tracer with default values' , ( ) => {
186- const tracer = new BasicTracerProvider ( { } ) . getTracer ( 'default' ) ;
189+ const tracer = new BasicTracerProvider ( { } ) . getTracer (
190+ 'default'
191+ ) as Tracer ;
187192 assert . deepStrictEqual ( tracer . getSpanLimits ( ) , {
188193 attributeValueLengthLimit : Infinity ,
189194 attributeCountLimit : 128 ,
@@ -201,7 +206,7 @@ describe('BasicTracerProvider', () => {
201206 spanLimits : {
202207 attributeCountLimit : 100 ,
203208 } ,
204- } ) . getTracer ( 'default' ) ;
209+ } ) . getTracer ( 'default' ) as Tracer ;
205210 const spanLimits = tracer . getSpanLimits ( ) ;
206211 assert . strictEqual ( spanLimits . attributeCountLimit , 100 ) ;
207212 } ) ;
@@ -213,7 +218,7 @@ describe('BasicTracerProvider', () => {
213218 spanLimits : {
214219 attributeValueLengthLimit : 10 ,
215220 } ,
216- } ) . getTracer ( 'default' ) ;
221+ } ) . getTracer ( 'default' ) as Tracer ;
217222 const spanLimits = tracer . getSpanLimits ( ) ;
218223 assert . strictEqual ( spanLimits . attributeValueLengthLimit , 10 ) ;
219224 } ) ;
@@ -223,7 +228,7 @@ describe('BasicTracerProvider', () => {
223228 spanLimits : {
224229 attributeValueLengthLimit : - 10 ,
225230 } ,
226- } ) . getTracer ( 'default' ) ;
231+ } ) . getTracer ( 'default' ) as Tracer ;
227232 const spanLimits = tracer . getSpanLimits ( ) ;
228233 assert . strictEqual ( spanLimits . attributeValueLengthLimit , - 10 ) ;
229234 } ) ;
@@ -232,14 +237,18 @@ describe('BasicTracerProvider', () => {
232237 describe ( 'when attribute value length limit is defined via env' , ( ) => {
233238 it ( 'should have general attribute value length limits value as defined with env' , ( ) => {
234239 envSource . OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT = '115' ;
235- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
240+ const tracer = new BasicTracerProvider ( ) . getTracer (
241+ 'default'
242+ ) as Tracer ;
236243 const generalLimits = tracer . getGeneralLimits ( ) ;
237244 assert . strictEqual ( generalLimits . attributeValueLengthLimit , 115 ) ;
238245 delete envSource . OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT ;
239246 } ) ;
240247 it ( 'should have span attribute value length limit value same as general limit value' , ( ) => {
241248 envSource . OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT = '125' ;
242- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
249+ const tracer = new BasicTracerProvider ( ) . getTracer (
250+ 'default'
251+ ) as Tracer ;
243252 const generalLimits = tracer . getGeneralLimits ( ) ;
244253 const spanLimits = tracer . getSpanLimits ( ) ;
245254 assert . strictEqual ( generalLimits . attributeValueLengthLimit , 125 ) ;
@@ -249,7 +258,9 @@ describe('BasicTracerProvider', () => {
249258 it ( 'should have span and general attribute value length limits as defined in env' , ( ) => {
250259 envSource . OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT = '125' ;
251260 envSource . OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT = '109' ;
252- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
261+ const tracer = new BasicTracerProvider ( ) . getTracer (
262+ 'default'
263+ ) as Tracer ;
253264 const spanLimits = tracer . getSpanLimits ( ) ;
254265 const generalLimits = tracer . getGeneralLimits ( ) ;
255266 assert . strictEqual ( generalLimits . attributeValueLengthLimit , 125 ) ;
@@ -260,7 +271,9 @@ describe('BasicTracerProvider', () => {
260271 it ( 'should have span attribute value length limit as default of Infinity' , ( ) => {
261272 envSource . OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT = '125' ;
262273 envSource . OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT = 'Infinity' ;
263- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
274+ const tracer = new BasicTracerProvider ( ) . getTracer (
275+ 'default'
276+ ) as Tracer ;
264277 const spanLimits = tracer . getSpanLimits ( ) ;
265278 const generalLimits = tracer . getGeneralLimits ( ) ;
266279 assert . strictEqual ( generalLimits . attributeValueLengthLimit , 125 ) ;
@@ -272,7 +285,9 @@ describe('BasicTracerProvider', () => {
272285
273286 describe ( 'when attribute value length limit is not defined via env' , ( ) => {
274287 it ( 'should use default value of Infinity' , ( ) => {
275- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
288+ const tracer = new BasicTracerProvider ( ) . getTracer (
289+ 'default'
290+ ) as Tracer ;
276291 const spanLimits = tracer . getSpanLimits ( ) ;
277292 const generalLimits = tracer . getGeneralLimits ( ) ;
278293 assert . strictEqual ( generalLimits . attributeValueLengthLimit , Infinity ) ;
@@ -283,14 +298,18 @@ describe('BasicTracerProvider', () => {
283298 describe ( 'when attribute count limit is defined via env' , ( ) => {
284299 it ( 'should general attribute count limit as defined with env' , ( ) => {
285300 envSource . OTEL_ATTRIBUTE_COUNT_LIMIT = '25' ;
286- const tracer = new BasicTracerProvider ( { } ) . getTracer ( 'default' ) ;
301+ const tracer = new BasicTracerProvider ( { } ) . getTracer (
302+ 'default'
303+ ) as Tracer ;
287304 const generalLimits = tracer . getGeneralLimits ( ) ;
288305 assert . strictEqual ( generalLimits . attributeCountLimit , 25 ) ;
289306 delete envSource . OTEL_ATTRIBUTE_COUNT_LIMIT ;
290307 } ) ;
291308 it ( 'should have span attribute count limit value same as general limit value' , ( ) => {
292309 envSource . OTEL_ATTRIBUTE_COUNT_LIMIT = '20' ;
293- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
310+ const tracer = new BasicTracerProvider ( ) . getTracer (
311+ 'default'
312+ ) as Tracer ;
294313 const generalLimits = tracer . getGeneralLimits ( ) ;
295314 const spanLimits = tracer . getSpanLimits ( ) ;
296315 assert . strictEqual ( generalLimits . attributeCountLimit , 20 ) ;
@@ -300,7 +319,9 @@ describe('BasicTracerProvider', () => {
300319 it ( 'should have span and general attribute count limits as defined in env' , ( ) => {
301320 envSource . OTEL_ATTRIBUTE_COUNT_LIMIT = '20' ;
302321 envSource . OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT = '35' ;
303- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
322+ const tracer = new BasicTracerProvider ( ) . getTracer (
323+ 'default'
324+ ) as Tracer ;
304325 const spanLimits = tracer . getSpanLimits ( ) ;
305326 const generalLimits = tracer . getGeneralLimits ( ) ;
306327 assert . strictEqual ( generalLimits . attributeCountLimit , 20 ) ;
@@ -311,7 +332,9 @@ describe('BasicTracerProvider', () => {
311332 it ( 'should have span attribute count limit as default of 128' , ( ) => {
312333 envSource . OTEL_ATTRIBUTE_COUNT_LIMIT = '20' ;
313334 envSource . OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT = '128' ;
314- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
335+ const tracer = new BasicTracerProvider ( ) . getTracer (
336+ 'default'
337+ ) as Tracer ;
315338 const spanLimits = tracer . getSpanLimits ( ) ;
316339 const generalLimits = tracer . getGeneralLimits ( ) ;
317340 assert . strictEqual ( generalLimits . attributeCountLimit , 20 ) ;
@@ -323,7 +346,9 @@ describe('BasicTracerProvider', () => {
323346
324347 describe ( 'when attribute count limit is not defined via env' , ( ) => {
325348 it ( 'should use default value of 128' , ( ) => {
326- const tracer = new BasicTracerProvider ( ) . getTracer ( 'default' ) ;
349+ const tracer = new BasicTracerProvider ( ) . getTracer (
350+ 'default'
351+ ) as Tracer ;
327352 const spanLimits = tracer . getSpanLimits ( ) ;
328353 const generalLimits = tracer . getGeneralLimits ( ) ;
329354 assert . strictEqual ( generalLimits . attributeCountLimit , 128 ) ;
@@ -337,7 +362,7 @@ describe('BasicTracerProvider', () => {
337362 spanLimits : {
338363 eventCountLimit : 300 ,
339364 } ,
340- } ) . getTracer ( 'default' ) ;
365+ } ) . getTracer ( 'default' ) as Tracer ;
341366 const spanLimits = tracer . getSpanLimits ( ) ;
342367 assert . strictEqual ( spanLimits . eventCountLimit , 300 ) ;
343368 } ) ;
@@ -349,7 +374,7 @@ describe('BasicTracerProvider', () => {
349374 spanLimits : {
350375 linkCountLimit : 10 ,
351376 } ,
352- } ) . getTracer ( 'default' ) ;
377+ } ) . getTracer ( 'default' ) as Tracer ;
353378 const spanLimits = tracer . getSpanLimits ( ) ;
354379 assert . strictEqual ( spanLimits . linkCountLimit , 10 ) ;
355380 } ) ;
@@ -362,7 +387,7 @@ describe('BasicTracerProvider', () => {
362387 attributeValueLengthLimit : 100 ,
363388 attributeCountLimit : 200 ,
364389 } ,
365- } ) . getTracer ( 'default' ) ;
390+ } ) . getTracer ( 'default' ) as Tracer ;
366391 const spanLimits = tracer . getSpanLimits ( ) ;
367392 assert . strictEqual ( spanLimits . attributeValueLengthLimit , 100 ) ;
368393 assert . strictEqual ( spanLimits . attributeCountLimit , 200 ) ;
@@ -380,7 +405,7 @@ describe('BasicTracerProvider', () => {
380405 attributeValueLengthLimit : 10 ,
381406 attributeCountLimit : 20 ,
382407 } ,
383- } ) . getTracer ( 'default' ) ;
408+ } ) . getTracer ( 'default' ) as Tracer ;
384409 const spanLimits = tracer . getSpanLimits ( ) ;
385410 assert . strictEqual ( spanLimits . attributeValueLengthLimit , 10 ) ;
386411 assert . strictEqual ( spanLimits . attributeCountLimit , 20 ) ;
@@ -458,7 +483,7 @@ describe('BasicTracerProvider', () => {
458483
459484 it ( 'should propagate resources' , ( ) => {
460485 const tracerProvider = new BasicTracerProvider ( ) ;
461- const tracer = tracerProvider . getTracer ( 'default' ) ;
486+ const tracer = tracerProvider . getTracer ( 'default' ) as Tracer ;
462487 const span = tracer . startSpan ( 'my-span' ) as Span ;
463488 assert . strictEqual ( tracer [ '_resource' ] , tracerProvider [ '_resource' ] ) ;
464489 assert . strictEqual ( span . resource , tracerProvider [ '_resource' ] ) ;
0 commit comments