-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(metrics): Fetch project config when metrics are received #2987
Conversation
|
||
let project = self.get_or_create_project(message.project_key()); | ||
project.prefetch(project_cache, false); | ||
project.merge_buckets( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change, the added integration test fails.
// TODO: When the state is present but expired, we should send buckets | ||
// to the metrics buffer instead. In practice, the project state should be | ||
// refreshed at the time when the buckets emerge from the aggregator though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do this, but I'll leave it for a follow-up.
{"buckets": {public_key: metrics}}, | ||
) | ||
|
||
envelope = mini_sentry.captured_events.get(timeout=3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This .get()
fails without the prefetch
.
message.buckets(), | ||
); | ||
|
||
let project = self.get_or_create_project(message.project_key()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just always prefetch in get_or_create_project
. I found the same "bug" for metric metadata as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dav1dde I would even go further and unify the multiple state enums we have for project configs at the moment:
GetOrFetch
- either a cached project config or a channelState
- either a cached project config or a metrics bufferExpiryState
- eitherUpdated
,Stale
, orExpired
We might be able to make a single enum out of these, and give them an interface that makes it impossible to access a project without prefetching.
Metrics that arrive through the global metrics endpoint do not currently trigger a refetch of the project config. If a single processing relay only receives metrics traffic (no envelopes) for a specific project, metrics might get stuck in the pre-aggregator a.k.a. metrics buffer.
ref: #2967.