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

ref(relay): Write project config revision to Redis #75523

Merged
merged 6 commits into from
Aug 5, 2024
Merged

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented Aug 2, 2024

See: getsentry/relay#3887

Writes the revision to Redis as a separate key. Allowing for optimized reads by revision.

#skip-changelog

@Dav1dde Dav1dde requested a review from a team as a code owner August 2, 2024 09:43
Copy link

sentry-io bot commented Aug 2, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/sentry/relay/projectconfig_cache/redis.py

Function Unhandled Issue
set_many ClusterDownError: CLUSTERDOWN error. Unable to rebuild the cluster sentry.tasks.relay.invalid...
Event Count: 3

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 2, 2024
@@ -63,6 +68,11 @@ def get(self, public_key):
rv = zstandard.decompress(rv_b).decode()
except (TypeError, zstandard.ZstdError):
# assume raw json
pass
rv = rv_b
Copy link
Member Author

Choose a reason for hiding this comment

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

Drive by fix ... That would have just blown up before because rv is not defined.

src/sentry/relay/projectconfig_cache/redis.py Outdated Show resolved Hide resolved
metrics.incr("relay.projectconfig_cache.write", amount=len(configs), tags={"action": "set"})

# Note: Those are multiple pipelines, one per cluster node
p = self.cluster.pipeline()
p = self.cluster.pipeline(transaction=False)
Copy link
Member Author

Choose a reason for hiding this comment

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

There is no need for this pipeline to be transactional (default value), all keys are independent.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.22%. Comparing base (eb7b3ec) to head (2eeeaa3).
Report is 22 commits behind head on master.

Files Patch % Lines
src/sentry/relay/projectconfig_cache/redis.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #75523      +/-   ##
==========================================
+ Coverage   77.34%   78.22%   +0.88%     
==========================================
  Files        6819     6821       +2     
  Lines      302757   302954     +197     
  Branches    52110    52139      +29     
==========================================
+ Hits       234159   236991    +2832     
+ Misses      62055    59593    -2462     
+ Partials     6543     6370     -173     
Files Coverage Δ
src/sentry/relay/projectconfig_cache/redis.py 94.44% <92.30%> (+1.26%) ⬆️

... and 221 files with indirect coverage changes

@Dav1dde Dav1dde merged commit 4578d31 into master Aug 5, 2024
49 checks passed
@Dav1dde Dav1dde deleted the dav1d/relay-rev-key branch August 5, 2024 11:29
Dav1dde added a commit to getsentry/relay that referenced this pull request Aug 6, 2024
Checks the 'new' revision key before actually loading and parsing the
project config.

Revision introduced here: getsentry/sentry#75523
Change is backwards compatible, if the key is missing the check is
simply skipped.

I was considering propagating the information whether something was
refreshed or a fresh fetch through the state channel, but after review
and consideration, I don't think that is useful information, we still
have to reset a bunch of internal state and move the project out of the
`in flight` status. All if which we already do, the only thing we could
change is skipping the assignment of the project info contained in the
project fetch state (because that's the same state as the old), but this
is already only an `Arc`.
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants