File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed
src/opentelemetry/sdk/trace/export Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - Add support for OTEL_BSP_X environment variables
6+ ([ #1105 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/1105 ) )
57- Moved samplers from API to SDK
68 ([ #1023 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/1023 ) )
79- Sampling spec changes
Original file line number Diff line number Diff line change @@ -120,23 +120,21 @@ def __init__(
120120 ):
121121
122122 if max_queue_size is None :
123- max_queue_size = Configuration ().get (
124- "OTEL_BSP_MAX_QUEUE_SIZE" , 2048
125- )
123+ max_queue_size = Configuration ().get ("BSP_MAX_QUEUE_SIZE" , 2048 )
126124
127125 if schedule_delay_millis is None :
128126 schedule_delay_millis = Configuration ().get (
129- "OTEL_BSP_SCHEDULE_DELAY_MILLIS " , 5000
127+ "BSP_SCHEDULE_DELAY_MILLIS " , 5000
130128 )
131129
132130 if max_export_batch_size is None :
133131 max_export_batch_size = Configuration ().get (
134- "OTEL_BSP_MAX_EXPORT_BATCH_SIZE " , 512
132+ "BSP_MAX_EXPORT_BATCH_SIZE " , 512
135133 )
136134
137135 if export_timeout_millis is None :
138136 export_timeout_millis = Configuration ().get (
139- "OTEL_BSP_EXPORT_TIMEOUT_MILLIS " , 30000
137+ "BSP_EXPORT_TIMEOUT_MILLIS " , 30000
140138 )
141139
142140 if max_queue_size <= 0 :
Original file line number Diff line number Diff line change @@ -136,6 +136,26 @@ def _create_start_and_end_span(name, span_processor):
136136
137137
138138class TestBatchExportSpanProcessor (unittest .TestCase ):
139+ @mock .patch .dict (
140+ "os.environ" ,
141+ {
142+ "OTEL_BSP_MAX_QUEUE_SIZE" : "10" ,
143+ "OTEL_BSP_SCHEDULE_DELAY_MILLIS" : "2" ,
144+ "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" : "3" ,
145+ "OTEL_BSP_EXPORT_TIMEOUT_MILLIS" : "4" ,
146+ },
147+ )
148+ def test_batch_span_processor_environment_variables (self ):
149+
150+ batch_span_processor = export .BatchExportSpanProcessor (
151+ MySpanExporter (destination = [])
152+ )
153+
154+ self .assertEqual (batch_span_processor .max_queue_size , 10 )
155+ self .assertEqual (batch_span_processor .schedule_delay_millis , 2 )
156+ self .assertEqual (batch_span_processor .max_export_batch_size , 3 )
157+ self .assertEqual (batch_span_processor .export_timeout_millis , 4 )
158+
139159 def test_shutdown (self ):
140160 spans_names_list = []
141161
You can’t perform that action at this time.
0 commit comments