62
62
environ .get (OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT , 128 )
63
63
)
64
64
65
- SPAN_EVENT_COUNT_LIMIT = int (environ .get (OTEL_SPAN_EVENT_COUNT_LIMIT , 128 ))
66
- SPAN_LINK_COUNT_LIMIT = int (environ .get (OTEL_SPAN_LINK_COUNT_LIMIT , 128 ))
67
- VALID_ATTR_VALUE_TYPES = (bool , str , int , float )
65
+ _SPAN_EVENT_COUNT_LIMIT = int (environ .get (OTEL_SPAN_EVENT_COUNT_LIMIT , 128 ))
66
+ _SPAN_LINK_COUNT_LIMIT = int (environ .get (OTEL_SPAN_LINK_COUNT_LIMIT , 128 ))
67
+ _VALID_ATTR_VALUE_TYPES = (bool , str , int , float )
68
68
# pylint: disable=protected-access
69
- TRACE_SAMPLER = sampling ._get_from_env_or_default ()
69
+ _TRACE_SAMPLER = sampling ._get_from_env_or_default ()
70
70
71
71
72
72
class SpanProcessor :
@@ -333,14 +333,14 @@ def _is_valid_attribute_value(value: types.AttributeValue) -> bool:
333
333
if element is None :
334
334
continue
335
335
element_type = type (element )
336
- if element_type not in VALID_ATTR_VALUE_TYPES :
336
+ if element_type not in _VALID_ATTR_VALUE_TYPES :
337
337
logger .warning (
338
338
"Invalid type %s in attribute value sequence. Expected one of "
339
339
"%s or None" ,
340
340
element_type .__name__ ,
341
341
[
342
342
valid_type .__name__
343
- for valid_type in VALID_ATTR_VALUE_TYPES
343
+ for valid_type in _VALID_ATTR_VALUE_TYPES
344
344
],
345
345
)
346
346
return False
@@ -356,12 +356,12 @@ def _is_valid_attribute_value(value: types.AttributeValue) -> bool:
356
356
)
357
357
return False
358
358
359
- elif not isinstance (value , VALID_ATTR_VALUE_TYPES ):
359
+ elif not isinstance (value , _VALID_ATTR_VALUE_TYPES ):
360
360
logger .warning (
361
361
"Invalid type %s for attribute value. Expected one of %s or a "
362
362
"sequence of those types" ,
363
363
type (value ).__name__ ,
364
- [valid_type .__name__ for valid_type in VALID_ATTR_VALUE_TYPES ],
364
+ [valid_type .__name__ for valid_type in _VALID_ATTR_VALUE_TYPES ],
365
365
)
366
366
return False
367
367
return True
@@ -640,7 +640,7 @@ def __init__(
640
640
if links is None :
641
641
self ._links = self ._new_links ()
642
642
else :
643
- self ._links = BoundedList .from_seq (SPAN_LINK_COUNT_LIMIT , links )
643
+ self ._links = BoundedList .from_seq (_SPAN_LINK_COUNT_LIMIT , links )
644
644
645
645
def __repr__ (self ):
646
646
return '{}(name="{}", context={})' .format (
@@ -653,11 +653,11 @@ def _new_attributes():
653
653
654
654
@staticmethod
655
655
def _new_events ():
656
- return BoundedList (SPAN_EVENT_COUNT_LIMIT )
656
+ return BoundedList (_SPAN_EVENT_COUNT_LIMIT )
657
657
658
658
@staticmethod
659
659
def _new_links ():
660
- return BoundedList (SPAN_LINK_COUNT_LIMIT )
660
+ return BoundedList (_SPAN_LINK_COUNT_LIMIT )
661
661
662
662
def get_span_context (self ):
663
663
return self ._context
@@ -962,7 +962,7 @@ class TracerProvider(trace_api.TracerProvider):
962
962
963
963
def __init__ (
964
964
self ,
965
- sampler : sampling .Sampler = TRACE_SAMPLER ,
965
+ sampler : sampling .Sampler = _TRACE_SAMPLER ,
966
966
resource : Resource = Resource .create ({}),
967
967
shutdown_on_exit : bool = True ,
968
968
active_span_processor : Union [
0 commit comments