Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle elasticsearch client native instrumentation #2393

Closed
xrmx opened this issue Apr 4, 2024 · 2 comments · Fixed by #2524
Closed

Handle elasticsearch client native instrumentation #2393

xrmx opened this issue Apr 4, 2024 · 2 comments · Fixed by #2524
Assignees
Labels
bug Something isn't working

Comments

@xrmx
Copy link
Contributor

xrmx commented Apr 4, 2024

Describe your environment

Elasticsearch client added native opentelemetry instrumentation in 8.13.0 and so currently without manual intervention it is possible to have our instrumentation and the client one create spans concurrently.

Steps to reproduce

Add opentelemetry instrumentation using elasticsearch client 8.13.0

What is the expected behavior?

Only the elasticsearch client creates spans.

What is the actual behavior?

Both client and opentelemetry instrumentation creates their own spans.

Additional context

Java opentelemetry instrumentation disables its instrumentation if a new enough elasticsearch client is found open-telemetry/opentelemetry-java-instrumentation#9337

@xrmx xrmx added the bug Something isn't working label Apr 4, 2024
@xrmx
Copy link
Contributor Author

xrmx commented Apr 5, 2024

Since we are hooking into transport perform_request we can check if one of its kwargs is otel_span (https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_sync/client/_base.py#L271) and if its enabled attribute is True (https://github.com/elastic/elasticsearch-py/blob/main/elasticsearch/_otel.py#L46).

@xrmx xrmx self-assigned this Apr 12, 2024
@xrmx
Copy link
Contributor Author

xrmx commented Apr 12, 2024

Before fixing this we need to make tests pass with elasticsearch 7 and 8

xrmx added a commit to xrmx/opentelemetry-python-contrib that referenced this issue May 15, 2024
… enabled

If elasticsearch is found with native OTel support enabled just call the
wrapped function without creating our own spans.

Fix open-telemetry#2393
xrmx added a commit to xrmx/opentelemetry-python-contrib that referenced this issue May 15, 2024
… enabled

If elasticsearch is found with native OTel support enabled just call the
wrapped function without creating our own spans.

Fix open-telemetry#2393
xrmx added a commit to xrmx/opentelemetry-python-contrib that referenced this issue May 16, 2024
… enabled

If elasticsearch is found with native OTel support enabled just call the
wrapped function without creating our own spans.

Fix open-telemetry#2393
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant