* Add Redis instrumentation query sanitization
Add a query sanitizer to the Redis instrumentation. This can be disabled
with the `sanitize_query = False` config option.
Given the query `SET key value`, the sanitized query becomes `SET ? ?`.
Both the keys and values are sanitized, as both can contain PII data.
The Redis queries are sanitized by default. This changes the default
behavior of this instrumentation. Previously it reported unsanitized
Redis queries.
This was previously discussed in the previous implementation of this PR
in PR #1571
Closes #1548
* Update Redis sanitize_query option documentation
Changes suggested in
https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572#discussion_r1066069584
* Remove uninstrument & instrument from test setup
The Redis test that performs the tests with the default options, doesn't
need to uninstrument and then instrument the instrumentor. This commit
removes the unnecessary setup code. The setup code is already present at
the top of the file.
* Fix code style formatting
* Update Redis functional tests
- Update the sanitizer to also account for a max `db.statement`
attribute value length. No longer than 1000 characters.
- Update the functional tests to assume the queries are sanitized by
default.
- Add new tests that test the behavior with sanitization turned off.
Only for the tests in the first test class. I don't think it's needed
to duplicate this test for the clustered and async setup combinations.
* Test Redis unsanitized queries by default
Change the Redis functional tests so that they test the unsanitized
query by default, and test the sanitized query results in the separate
test functions.
This is a partial revert of the previous commit
|
||
|---|---|---|
| .. | ||
| src/opentelemetry/instrumentation/redis | ||
| tests | ||
| LICENSE | ||
| README.rst | ||
| pyproject.toml | ||
README.rst
OpenTelemetry Redis Instrumentation
===================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-redis.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-redis/
This library allows tracing requests made by the Redis library.
Installation
------------
::
pip install opentelemetry-instrumentation-redis
References
----------
* `OpenTelemetry Redis Instrumentation <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/redis/redis.html>`_
* `OpenTelemetry Project <https://opentelemetry.io/>`_
* `OpenTelemetry Python Examples <https://github.com/open-telemetry/opentelemetry-python/tree/main/docs/examples>`_