Skip to content

Commit

Permalink
[Python] New cache_prefixes config param for RedisInstegration. (#…
Browse files Browse the repository at this point in the history
…10104)


---------

Co-authored-by: Ivana Kellyerova <ivana.kellyerova@sentry.io>
  • Loading branch information
antonpirker and sentrivana authored May 24, 2024
1 parent 2e15c74 commit 8d6fe65
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/platforms/python/integrations/redis/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,27 @@ sentry_sdk.init(
integrations=[
RedisIntegration(
max_data_size=None,
cache_prefixes=["mycache", "template.cache"],
),
],
)
```
You can pass the following keyword arguments to `RedisIntegration()`:

- `max_data_size`:
- `max_data_size`

By default `RedisIntegration()` will trim data collected after `1024` characters. You can change this behavior with the `max_data_size` parameter:

- When you set `max_data_size` to a value that evaluates to `False` (like `0` or `None`) no trimming will take place. The whole Redis command will be recorded.
- Alternatively, you can set `max_data_size` to an integer to control how many characters should be collected.
You can set `max_data_size` to an integer to control how many characters should be collected.

When you set `max_data_size` to a value that evaluates to `False` (like `0` or `None`), no trimming will take place. The whole Redis command will be recorded.

- `cache_prefixes`

You can specify a list of prefixes to Redis keys to define a key space that should be considered as cache. Cache keys will show up in the cache-monitoring dashboard, giving you more insight into your caching strategy.

For example, if you, set `cache_prefixes` to `["template.cache", "middleware.cache"]`, then access to all Redis keys starting with `template.cache` or `middleware.cache` will show up in your cache-monitoring dashboard.


## Supported Versions

Expand Down

0 comments on commit 8d6fe65

Please sign in to comment.