File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
instrumentation/opentelemetry-instrumentation-elasticsearch/tests Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -463,6 +463,26 @@ def response_hook(span, response):
463
463
spans [0 ].attributes [response_attribute_name ],
464
464
)
465
465
466
+ def test_no_op_tracer_provider (self , request_mock ):
467
+ ElasticsearchInstrumentor ().uninstrument ()
468
+ ElasticsearchInstrumentor ().instrument (
469
+ tracer_provider = trace .NoOpTracerProvider ()
470
+ )
471
+ response_payload = '{"found": false, "timed_out": true, "took": 7}'
472
+ request_mock .return_value = (
473
+ 1 ,
474
+ {},
475
+ response_payload ,
476
+ )
477
+ es = Elasticsearch ()
478
+ res = es .get (index = "test-index" , doc_type = "_doc" , id = 1 )
479
+ self .assertEqual (
480
+ res .get ("found" ), json .loads (response_payload ).get ("found" )
481
+ )
482
+
483
+ spans_list = self .get_finished_spans ()
484
+ self .assertEqual (len (spans_list ), 0 )
485
+
466
486
def test_body_sanitization (self , _ ):
467
487
self .assertEqual (
468
488
sanitize_body (sanitization_queries .interval_query ),
You can’t perform that action at this time.
0 commit comments