Skip to content
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

Redis Cache Module - 1 - Prepare Code #3073

Merged
merged 85 commits into from
May 23, 2024

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented May 15, 2024

Make the redis integration fit for sending Span data that is eligible for the Caches performance module in Sentry.

There will be a chain of PRs.

This first PR is organizing the existing code in modules to make it more maintainable. The code has not changed, only reformatted.

Part 1/2 for fixing #2965
Part 2 is here: #3075

@antonpirker antonpirker changed the title Redis Cache Module Redis Cache Module - 1 - Prepare Code May 17, 2024
@antonpirker antonpirker marked this pull request as ready for review May 17, 2024 13:55
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great. Couple suggestions:

  • I'd rename common_async.py and common_sync.py to _async_common.py and _sync_common.py to mirror _asgi_common.py and _wsgi_common.py
  • Regarding rediscluster.py and redis_cluster.py, this will probably get confusing fast. Maybe we can call the old one redis_cluster_legacy.py or redis_py_cluster.py?

@antonpirker
Copy link
Member Author

Makes sense! I updated the code. Lets see if CI is happy!

antonpirker and others added 13 commits May 21, 2024 16:53
* Some work to use same function for queries and caches module

* Moved functions to better place

* Added tests

* Fix

* Tests and linting

* Thats important for Python 3.6

* Fixed some tests

* Removed ipdb

* more fixing

* Cleanup

* Async cache spans

* Added async tests

* Fixed async tests

* Guard for not running async tests when there is no async fakeredis for that python version

* linting

* Use new names for ops

* Renamed for consistency

* fix _get_op()

* Cleaning up unused properties/parameters

* Use _get_safe_key in Django integration

* Fixed typing

* More tests

* Only return the keys in set_many, makes more sense

* Linting

* Cleanup

* fix(clickhouse): `_sentry_span` might be missing (#3096)

We started auto-enabling the ClickHouse integration in 2.0+. This led to it getting auto-enabled also for folks using ClickHouse with Django via `django-clickhouse-backend`, but it turns out that the integration doesn't work properly with `django-clickhouse-backend` and leads to `AttributeError: 'Connection' object has no attribute '_sentry_span'`.

* Make _get_safe_key work for all multi key methods in django and redis

* Fixed kwargs case and updated tests

* Updated tests

* cache.set should be cache.put

* Fix `cohere` testsuite for new release of `cohere`. (#3098)

* Check for new class to signal end of stream

---------

Co-authored-by: Ivana Kellyerova <ivana.kellyerova@sentry.io>
Base automatically changed from antonpirker/django-caching-module to master May 23, 2024 08:06
@antonpirker antonpirker merged commit 121aa0e into master May 23, 2024
111 checks passed
@antonpirker antonpirker deleted the antonpirker/redis-cache-module-1 branch May 23, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants