17 Commits

Author SHA1 Message Date
05073008a3 Re-raise redis.WatchErrors when they occur (#2721) 2024-07-18 10:11:04 -07:00
7567efa341 Handle redis.exceptions.WatchError as a non-error event in instrumentation (#2668) 2024-07-15 10:09:36 -07:00
728976fb10 Fix net peer attribute for unix socket connection (#2493) 2024-05-30 14:50:53 -07:00
6c13a5eddc Drop support for 3.7 (#2152)
* Drop support for 3.7

Fixes #2151

* Remove 37
2024-02-03 11:57:08 -06:00
cd6b024327 Fix async redis clients tracing (#1830)
* Fix async redis clients tracing

* Update changelog

* Add functional integration tests and fix linting issues

---------

Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-25 15:03:54 +03:00
37d85f0745 Sanitize redis db_statement by default (#1776)
Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Co-authored-by: Shalev Roda <65566801+shalevr@users.noreply.github.com>
2023-06-13 12:37:55 +00:00
0417141a70 Add support for enabling Redis sanitization from environment variable (#1690)
* Add support for enabling Redis sanitization from environment variable

* add sanitization environment variable docs

* strip environment variable

* update changelog

* lint

* lint

* lint - hopefully the last time

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-25 01:27:31 +00:00
2b6f913790 Add Redis instrumentation query sanitization (#1572)
* 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
8d56c2f72e12c7d7dc4ef25a9fe6a69ea685a6d8

* Fix formatting issue in Redis utils

* Disable Redis query sanitization by default

Update the Redis instrumentation library to not change the default
behavior for the Redis instrumentation. This can be enabled at a later
time when the spec discussion about this topic has concluded.

https://github.com/open-telemetry/opentelemetry-specification/issues/3104

* Fix pylint issue

Remove else statement.

* Update changelog about Redis query sanitization default

[ci skip]

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>

* Fix potential error on Redis args being 0

Check the length of the args array and return an empty string if there
are no args.

That way it won't cause an IndexError if the args array is empty and it
tries to fetch the first element, which should be the Redis command.

---------

Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
2023-02-04 14:22:23 +00:00
43d0c6cae3 fix the instantiation of NoOpTracerProvider (#1577) 2023-01-12 17:16:03 +00:00
494bf0999c add a test for redis using NoOpTracerProvider (#1559) 2023-01-09 09:15:00 +00:00
d75194aed7 Sync with sdk setup from setUpClass to setUp (#1193) 2022-07-19 02:02:13 +05:30
db636a462c adding response_hook to redis instrumentor (#669) 2021-09-14 13:47:12 -07:00
f436514554 Replaced Tracer.use_span() with opentelemetry.trace.use_span() (#364) 2021-03-08 09:33:49 -08:00
ee90c7e50c Update redis instrumentation to follow semantic conventions 2020-11-15 02:10:34 +05:30
dfb0621a9b Use is_recording flag in aiopg, asyncpg, dbapi, psycopg2, pymemcache, pymongo, redis, sqlalchemy instrumentations (#1212) 2020-10-21 22:05:37 -07:00
aa9f54e769 instrumentation/redis: Change Redis instrument to use SpanKind.CLIENT (#965) 2020-10-21 22:05:37 -07:00
2e237cf760 Rename db framework packages from "ext" to "instrumentation" (#966) 2020-10-21 22:05:37 -07:00