-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(server): Send pre-aggregated metrics in batches #966
Conversation
tags: metric.tags, | ||
})?; | ||
} | ||
for bucket in Bucket::parse_all(&payload).unwrap_or_default() { |
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.
@jan-auer It feels wrong that we have to deserialize here. Is there any way we can bypass the serialization step?
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.
Agreed, and we have the same issue with sessions. Right now, there's no straight forward way to avoid it, since we have to transform the payload and insert new attributes.
We could move this step into the EventManager, bypassing the Envelope, but I'm not clear yet what a good solution would look like. For now, I'd propose to keep it this way and solve both metrics and sessions together.
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.
Sounds good.
Uses the metrics aggregator from #958 to send batches of pre-aggregated
buckets to the upstream instead of forwarding individual metric values.
If sending fails for any reason, the metrics are merged back into the
aggregator, which will retry flushing after the next interval.
Metric envelopes are not queued like regular envelopes. Instead, they go
straight to the
EventProcessor
worker pool, where they are parsed,normalized and sent to the project's aggregator. This ensures that
metric requests do not create long running futures that would slow down
the system. For mixed envelopes, metric items are split off and handled
separately.
Metrics aggregators are spawned on the projects thread, which runs the
project cache and manages all project state access. In the future,
metrics aggregation will have to be moved to a separate resource to
ensure that project state requests remain instant.