-
Notifications
You must be signed in to change notification settings - Fork 599
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
Don't create Elasticsearch span names containing document IDs #705
Conversation
This feels like short term hack than a proper solution. We should try to update the instrumentation so we can follow the Otel conventions and use |
In case you cannot do that right now but need a fix urgently, you can use the request hook to provide a callback that updates the span name to whatever works for you. |
I feel like this is a serious problem affecting anyone using the Elasticsearch instrumentation (at least with non-autogenerated IDs). I was genuinely surprised to see no open issue about this. I find the instrumentation quite unusable when it will generate multiple new span names for every indexed document, even causing performance issues with the Jaeger web interface. I am with you on the current code being quite limited, and this being a stopgap measure. However keeping the elasticsearch instrumentation in the repo while requiring all users to implement their own patch doesn't seem like it helps anyone. Getting to the operation names you describe is essentially a full rewrite of the package. Not necessarily a difficult one, there are just many methods to instrument. |
OK. Can you open an issue and describe the long term solution there? Then add a TODO to your regex solution and link to the issue. |
Done: created #708, mentioned it in a comment |
Thanks. Looking good. Please add a test case and fix lint issues (if any) and we can merge this. |
Also please add a changelog entry to CHANGELOG.md |
@remram44 can you please resolve the conflicts so we can merge this and include in the next release happening in 1-2 days? |
Yes I will look into it! |
The test failure ( |
Elasticsearch creates URLs for index() and delete() before they hit perform_request(). This means there would be many unique span names containing unique document IDs, of the form 'Elasticsearch/indexname/_doc/documentid'. This extracts the document ID from the URL and replaces it with ':id', then puts it in the span's attributes.
Head branch was pushed to by a user without write access
Rebased again |
Description
This removes the unique document IDs from the span names, replacing them with ':id'. It greatly reduces the number of span names created by the elasticsearch intrumentation (e.g. no longer potentially infinite).
Note that this only works if the mapping type is
_doc
. Unfortunately elasticsearchindex()
/delete()
/... uses_make_path()
before callingperform_request()
and this is not easily reversible. I believe this to be fine because mapping types are deprecated since Elasticsearch 7: https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.htmlFixes #704
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
tox -e py38-test-instrumentation-elasticsearch6
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.