If we use the AsyncElasticsearch class instead of Elasticsearch, it is not automatically instrumented.
Unless I'm missing something, we should be able to just add
_wrap(
elasticsearch,
"AsyncTransport.perform_request",
_wrap_perform_request(
tracer, self._span_name_prefix, request_hook, response_hook
),
)
to the following:
def _instrument(self, **kwargs):
"""
Instruments elasticsarch module
"""
tracer_provider = kwargs.get("tracer_provider")
tracer = get_tracer(__name__, __version__, tracer_provider)
request_hook = kwargs.get("request_hook")
response_hook = kwargs.get("response_hook")
_wrap(
elasticsearch,
"Transport.perform_request",
_wrap_perform_request(
tracer, self._span_name_prefix, request_hook, response_hook
),
)
If we use the
AsyncElasticsearchclass instead ofElasticsearch, it is not automatically instrumented.Unless I'm missing something, we should be able to just add
to the following: