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

feat(server): Send pre-aggregated metrics in batches #966

Merged
merged 12 commits into from
Mar 30, 2021

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Mar 26, 2021

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.

tags: metric.tags,
})?;
}
for bucket in Bucket::parse_all(&payload).unwrap_or_default() {
Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good.

@jan-auer jan-auer changed the title feat(server): Initial implementation of bucketed metrics feat(server): Send pre-aggregated metrics in batches Mar 26, 2021
@jan-auer jan-auer marked this pull request as ready for review March 26, 2021 19:19
@jan-auer jan-auer requested a review from a team March 26, 2021 19:19
@jjbayer jjbayer merged commit e2f04d6 into master Mar 30, 2021
@jjbayer jjbayer deleted the feat/send-aggregate-metrics branch March 30, 2021 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants