Skip to content

[instrumentation-elasticsearch] Add instrumentation of AsyncTransport #1205

Description

@jiewpeng

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
            ),
        )

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions