-
Notifications
You must be signed in to change notification settings - Fork 626
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
add elasticsearch db.statement sanitization #1598
add elasticsearch db.statement sanitization #1598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a description of the param 'sanitize_query' in the init file (line 54)
...ry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/__init__.py
Outdated
Show resolved
Hide resolved
Can we use the same sanitization function for all of the db libraries? |
I think that this could be an option for all SQL-based DBs, but if we focus on "specific sanitization" for all DB libraries this has some potential to over complicated this issue |
CHANGELOG.md
Outdated
- `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. ([#1572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572)) | ||
- Add default query sanitization for elasticsearch db.statement attribute | ||
([#1545](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1545)) | ||
- `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The merge with the main accidentally adds this entry
CHANGELOG.md
Outdated
@@ -9,7 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
### Added | |||
|
|||
- `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. ([#1572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572)) | |||
- Add default query sanitization for elasticsearch db.statement attribute | |||
([#1545](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1545)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR is not #1598 ?
LGTM |
FYI this does not work with the elasticsearch bulk API, see #1868 |
@@ -135,11 +138,16 @@ def _instrument(self, **kwargs): | |||
tracer = get_tracer(__name__, __version__, tracer_provider) | |||
request_hook = kwargs.get("request_hook") | |||
response_hook = kwargs.get("response_hook") | |||
sanitize_query = kwargs.get("sanitize_query", False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the default be True? See also open-telemetry/opentelemetry-specification#3104
Description
Added an optional query sanitizer to the elasticsearch instrumentation.
Usage
ElasticsearchInstrumentor().instrument(sanitize_query=True)
This will affect the DB_STATEMENT value to contain the original query or sanitized one.
Fixes #1545
Following the specification discussion here
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist: