@@ -45,6 +45,7 @@ def __init__(self, max_batch_size, callback):
4545 self .callback = callback
4646 super (CustomLogHandler , self ).__init__ (
4747 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
48+ enable_stats_metrics = False ,
4849 )
4950
5051 def export (self , batch ):
@@ -77,12 +78,15 @@ def test_ctor(self):
7778 from opencensus .ext .azure .common import Options
7879 instrumentation_key = Options ._default .instrumentation_key
7980 Options ._default .instrumentation_key = None
80- self .assertRaises (ValueError , lambda : log_exporter .AzureLogHandler ())
81+ self .assertRaises (ValueError , lambda : log_exporter .AzureLogHandler (
82+ enable_stats_metrics = False ,
83+ ))
8184 Options ._default .instrumentation_key = instrumentation_key
8285
8386 def test_invalid_sampling_rate (self ):
8487 with self .assertRaises (ValueError ):
8588 log_exporter .AzureLogHandler (
89+ enable_stats_metrics = False ,
8690 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
8791 logging_sampling_rate = 4.0 ,
8892 )
@@ -100,6 +104,7 @@ def test_init_handler_with_proxies(self):
100104
101105 def test_init_handler_with_queue_capacity (self ):
102106 handler = log_exporter .AzureLogHandler (
107+ enable_stats_metrics = False ,
103108 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
104109 queue_capacity = 500 ,
105110 )
@@ -118,6 +123,7 @@ def test_init_handler_with_queue_capacity(self):
118123 def test_exception (self , requests_mock ):
119124 logger = logging .getLogger (self .id ())
120125 handler = log_exporter .AzureLogHandler (
126+ enable_stats_metrics = False ,
121127 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
122128 storage_path = os .path .join (TEST_FOLDER , self .id ()),
123129 )
@@ -135,6 +141,7 @@ def test_exception(self, requests_mock):
135141 def test_exception_with_custom_properties (self , requests_mock ):
136142 logger = logging .getLogger (self .id ())
137143 handler = log_exporter .AzureLogHandler (
144+ enable_stats_metrics = False ,
138145 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
139146 storage_path = os .path .join (TEST_FOLDER , self .id ()),
140147 )
@@ -160,6 +167,7 @@ def test_exception_with_custom_properties(self, requests_mock):
160167 @mock .patch ('requests.post' , return_value = mock .Mock ())
161168 def test_export_empty (self , request_mock ):
162169 handler = log_exporter .AzureLogHandler (
170+ enable_stats_metrics = False ,
163171 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
164172 storage_path = os .path .join (TEST_FOLDER , self .id ()),
165173 )
@@ -172,6 +180,7 @@ def test_export_empty(self, request_mock):
172180 def test_export_failure (self , log_record_to_envelope_mock ):
173181 log_record_to_envelope_mock .return_value = ['bar' ]
174182 handler = log_exporter .AzureLogHandler (
183+ enable_stats_metrics = False ,
175184 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
176185 storage_path = os .path .join (TEST_FOLDER , self .id ()),
177186 )
@@ -185,6 +194,7 @@ def test_export_failure(self, log_record_to_envelope_mock):
185194
186195 def test_log_record_to_envelope (self ):
187196 handler = log_exporter .AzureLogHandler (
197+ enable_stats_metrics = False ,
188198 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
189199 storage_path = os .path .join (TEST_FOLDER , self .id ()),
190200 )
@@ -201,6 +211,7 @@ def test_log_record_to_envelope(self):
201211 def test_log_record_with_custom_properties (self , requests_mock ):
202212 logger = logging .getLogger (self .id ())
203213 handler = log_exporter .AzureLogHandler (
214+ enable_stats_metrics = False ,
204215 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
205216 storage_path = os .path .join (TEST_FOLDER , self .id ()),
206217 )
@@ -222,6 +233,7 @@ def test_log_record_with_custom_properties(self, requests_mock):
222233 def test_log_with_invalid_custom_properties (self , requests_mock ):
223234 logger = logging .getLogger (self .id ())
224235 handler = log_exporter .AzureLogHandler (
236+ enable_stats_metrics = False ,
225237 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
226238 storage_path = os .path .join (TEST_FOLDER , self .id ()),
227239 )
@@ -248,6 +260,7 @@ def test_log_with_invalid_custom_properties(self, requests_mock):
248260 def test_log_record_sampled (self , requests_mock ):
249261 logger = logging .getLogger (self .id ())
250262 handler = log_exporter .AzureLogHandler (
263+ enable_stats_metrics = False ,
251264 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
252265 logging_sampling_rate = 1.0 ,
253266 )
@@ -267,6 +280,7 @@ def test_log_record_sampled(self, requests_mock):
267280 def test_log_record_not_sampled (self , requests_mock ):
268281 logger = logging .getLogger (self .id ())
269282 handler = log_exporter .AzureLogHandler (
283+ enable_stats_metrics = False ,
270284 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
271285 logging_sampling_rate = 0.0 ,
272286 )
@@ -284,18 +298,22 @@ def test_ctor(self):
284298 from opencensus .ext .azure .common import Options
285299 instrumentation_key = Options ._default .instrumentation_key
286300 Options ._default .instrumentation_key = None
287- self .assertRaises (ValueError , lambda : log_exporter .AzureEventHandler ())
301+ self .assertRaises (ValueError , lambda : log_exporter .AzureEventHandler (
302+ enable_stats_metrics = False ,
303+ ))
288304 Options ._default .instrumentation_key = instrumentation_key
289305
290306 def test_invalid_sampling_rate (self ):
291307 with self .assertRaises (ValueError ):
292308 log_exporter .AzureEventHandler (
309+ enable_stats_metrics = False ,
293310 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
294311 logging_sampling_rate = 4.0 ,
295312 )
296313
297314 def test_init_handler_with_proxies (self ):
298315 handler = log_exporter .AzureEventHandler (
316+ enable_stats_metrics = False ,
299317 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
300318 proxies = '{"https":"https://test-proxy.com"}' ,
301319 )
@@ -307,6 +325,7 @@ def test_init_handler_with_proxies(self):
307325
308326 def test_init_handler_with_queue_capacity (self ):
309327 handler = log_exporter .AzureEventHandler (
328+ enable_stats_metrics = False ,
310329 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
311330 queue_capacity = 500 ,
312331 )
@@ -325,6 +344,7 @@ def test_init_handler_with_queue_capacity(self):
325344 def test_exception (self , requests_mock ):
326345 logger = logging .getLogger (self .id ())
327346 handler = log_exporter .AzureEventHandler (
347+ enable_stats_metrics = False ,
328348 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
329349 storage_path = os .path .join (TEST_FOLDER , self .id ()),
330350 )
@@ -342,6 +362,7 @@ def test_exception(self, requests_mock):
342362 def test_exception_with_custom_properties (self , requests_mock ):
343363 logger = logging .getLogger (self .id ())
344364 handler = log_exporter .AzureEventHandler (
365+ enable_stats_metrics = False ,
345366 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
346367 storage_path = os .path .join (TEST_FOLDER , self .id ()),
347368 )
@@ -367,6 +388,7 @@ def test_exception_with_custom_properties(self, requests_mock):
367388 @mock .patch ('requests.post' , return_value = mock .Mock ())
368389 def test_export_empty (self , request_mock ):
369390 handler = log_exporter .AzureEventHandler (
391+ enable_stats_metrics = False ,
370392 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
371393 storage_path = os .path .join (TEST_FOLDER , self .id ()),
372394 )
@@ -379,6 +401,7 @@ def test_export_empty(self, request_mock):
379401 def test_export_failure (self , log_record_to_envelope_mock ):
380402 log_record_to_envelope_mock .return_value = ['bar' ]
381403 handler = log_exporter .AzureEventHandler (
404+ enable_stats_metrics = False ,
382405 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
383406 storage_path = os .path .join (TEST_FOLDER , self .id ()),
384407 )
@@ -392,6 +415,7 @@ def test_export_failure(self, log_record_to_envelope_mock):
392415
393416 def test_log_record_to_envelope (self ):
394417 handler = log_exporter .AzureEventHandler (
418+ enable_stats_metrics = False ,
395419 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
396420 storage_path = os .path .join (TEST_FOLDER , self .id ()),
397421 )
@@ -408,6 +432,7 @@ def test_log_record_to_envelope(self):
408432 def test_log_record_with_custom_properties (self , requests_mock ):
409433 logger = logging .getLogger (self .id ())
410434 handler = log_exporter .AzureEventHandler (
435+ enable_stats_metrics = False ,
411436 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
412437 storage_path = os .path .join (TEST_FOLDER , self .id ()),
413438 )
@@ -429,6 +454,7 @@ def test_log_record_with_custom_properties(self, requests_mock):
429454 def test_log_with_invalid_custom_properties (self , requests_mock ):
430455 logger = logging .getLogger (self .id ())
431456 handler = log_exporter .AzureEventHandler (
457+ enable_stats_metrics = False ,
432458 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
433459 storage_path = os .path .join (TEST_FOLDER , self .id ()),
434460 )
@@ -455,6 +481,7 @@ def test_log_with_invalid_custom_properties(self, requests_mock):
455481 def test_log_record_sampled (self , requests_mock ):
456482 logger = logging .getLogger (self .id ())
457483 handler = log_exporter .AzureEventHandler (
484+ enable_stats_metrics = False ,
458485 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
459486 logging_sampling_rate = 1.0 ,
460487 )
@@ -474,6 +501,7 @@ def test_log_record_sampled(self, requests_mock):
474501 def test_log_record_not_sampled (self , requests_mock ):
475502 logger = logging .getLogger (self .id ())
476503 handler = log_exporter .AzureEventHandler (
504+ enable_stats_metrics = False ,
477505 instrumentation_key = '12345678-1234-5678-abcd-12345678abcd' ,
478506 logging_sampling_rate = 0.0 ,
479507 )
0 commit comments