Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracer… (#1616)

* Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracerProvider

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
Akochavi
2023-02-18 04:07:07 +02:00
committed by GitHub
parent 52d01f9e6f
commit aa6397ad59

View File

@ -463,6 +463,26 @@ class TestElasticsearchIntegration(TestBase):
spans[0].attributes[response_attribute_name],
)
def test_no_op_tracer_provider(self, request_mock):
ElasticsearchInstrumentor().uninstrument()
ElasticsearchInstrumentor().instrument(
tracer_provider=trace.NoOpTracerProvider()
)
response_payload = '{"found": false, "timed_out": true, "took": 7}'
request_mock.return_value = (
1,
{},
response_payload,
)
es = Elasticsearch()
res = es.get(index="test-index", doc_type="_doc", id=1)
self.assertEqual(
res.get("found"), json.loads(response_payload).get("found")
)
spans_list = self.get_finished_spans()
self.assertEqual(len(spans_list), 0)
def test_body_sanitization(self, _):
self.assertEqual(
sanitize_body(sanitization_queries.interval_query),