add elasticsearch db.statement sanitization#1598
Merged
srikanthccv merged 15 commits intoopen-telemetry:mainfrom Feb 10, 2023
Merged
add elasticsearch db.statement sanitization#1598srikanthccv merged 15 commits intoopen-telemetry:mainfrom
srikanthccv merged 15 commits intoopen-telemetry:mainfrom
Conversation
avzis
reviewed
Jan 24, 2023
Contributor
avzis
left a comment
There was a problem hiding this comment.
Maybe add a description of the param 'sanitize_query' in the init file (line 54)
shalevr
reviewed
Jan 24, 2023
...ry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/__init__.py
Outdated
Show resolved
Hide resolved
Member
|
Can we use the same sanitization function for all of the db libraries? |
Member
Author
|
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 |
shalevr
reviewed
Feb 5, 2023
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. |
Member
There was a problem hiding this comment.
The merge with the main accidentally adds this entry
shalevr
reviewed
Feb 5, 2023
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)) |
Member
|
LGTM |
shalevr
approved these changes
Feb 5, 2023
Contributor
|
FYI this does not work with the elasticsearch bulk API, see #1868 |
| 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.
Shouldn't the default be True? See also open-telemetry/opentelemetry-specification#3104
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: