@@ -189,6 +189,7 @@ def get_tracer(
189
189
instrumenting_module_name : str ,
190
190
instrumenting_library_version : typing .Optional [str ] = None ,
191
191
schema_url : typing .Optional [str ] = None ,
192
+ attributes : typing .Optional [types .Attributes ] = None ,
192
193
) -> "Tracer" :
193
194
"""Returns a `Tracer` for use by the given instrumentation library.
194
195
@@ -216,6 +217,7 @@ def get_tracer(
216
217
``importlib.metadata.version(instrumenting_library_name)``.
217
218
218
219
schema_url: Optional. Specifies the Schema URL of the emitted telemetry.
220
+ attributes: Optional. Specifies the attributes of the emitted telemetry.
219
221
"""
220
222
221
223
@@ -230,6 +232,7 @@ def get_tracer(
230
232
instrumenting_module_name : str ,
231
233
instrumenting_library_version : typing .Optional [str ] = None ,
232
234
schema_url : typing .Optional [str ] = None ,
235
+ attributes : typing .Optional [types .Attributes ] = None ,
233
236
) -> "Tracer" :
234
237
# pylint:disable=no-self-use,unused-argument
235
238
return NoOpTracer ()
@@ -249,17 +252,20 @@ def get_tracer(
249
252
instrumenting_module_name : str ,
250
253
instrumenting_library_version : typing .Optional [str ] = None ,
251
254
schema_url : typing .Optional [str ] = None ,
255
+ attributes : typing .Optional [types .Attributes ] = None ,
252
256
) -> "Tracer" :
253
257
if _TRACER_PROVIDER :
254
258
return _TRACER_PROVIDER .get_tracer (
255
259
instrumenting_module_name ,
256
260
instrumenting_library_version ,
257
261
schema_url ,
262
+ attributes ,
258
263
)
259
264
return ProxyTracer (
260
265
instrumenting_module_name ,
261
266
instrumenting_library_version ,
262
267
schema_url ,
268
+ attributes ,
263
269
)
264
270
265
271
@@ -407,10 +413,12 @@ def __init__(
407
413
instrumenting_module_name : str ,
408
414
instrumenting_library_version : typing .Optional [str ] = None ,
409
415
schema_url : typing .Optional [str ] = None ,
416
+ attributes : typing .Optional [types .Attributes ] = None ,
410
417
):
411
418
self ._instrumenting_module_name = instrumenting_module_name
412
419
self ._instrumenting_library_version = instrumenting_library_version
413
420
self ._schema_url = schema_url
421
+ self ._attributes = attributes
414
422
self ._real_tracer : Optional [Tracer ] = None
415
423
self ._noop_tracer = NoOpTracer ()
416
424
@@ -424,6 +432,7 @@ def _tracer(self) -> Tracer:
424
432
self ._instrumenting_module_name ,
425
433
self ._instrumenting_library_version ,
426
434
self ._schema_url ,
435
+ self ._attributes ,
427
436
)
428
437
return self ._real_tracer
429
438
return self ._noop_tracer
@@ -492,6 +501,7 @@ def get_tracer(
492
501
instrumenting_library_version : typing .Optional [str ] = None ,
493
502
tracer_provider : Optional [TracerProvider ] = None ,
494
503
schema_url : typing .Optional [str ] = None ,
504
+ attributes : typing .Optional [types .Attributes ] = None ,
495
505
) -> "Tracer" :
496
506
"""Returns a `Tracer` for use by the given instrumentation library.
497
507
@@ -503,7 +513,10 @@ def get_tracer(
503
513
if tracer_provider is None :
504
514
tracer_provider = get_tracer_provider ()
505
515
return tracer_provider .get_tracer (
506
- instrumenting_module_name , instrumenting_library_version , schema_url
516
+ instrumenting_module_name ,
517
+ instrumenting_library_version ,
518
+ schema_url ,
519
+ attributes ,
507
520
)
508
521
509
522
0 commit comments