mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-08-03 04:10:48 +08:00
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:
@ -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),
|
||||
|
Reference in New Issue
Block a user