Skip to content

Commit

Permalink
Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracer… (
Browse files Browse the repository at this point in the history
#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>
  • Loading branch information
3 people authored Feb 18, 2023
1 parent 52d01f9 commit aa6397a
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,26 @@ def response_hook(span, response):
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),
Expand Down

0 comments on commit aa6397a

Please sign in to comment.