Skip to content

ref(metrics): Replace per-project aggregators with single system service - #1065

Merged
jan-auer merged 4 commits into
masterfrom
ref/single-aggregator-2
Aug 30, 2021
Merged

jan-auer merged 4 commits into
masterfrom
ref/single-aggregator-2

Conversation

@jjbayer

@jjbayer jjbayer commented Aug 27, 2021 •

Copy link
Copy Markdown
Member

Changes the aggregator so that it becomes a system-level singleton. Most notably, this creates a single flush loop for all metrics rather than one per project, which reduces scheduling overheads.

In this PR:

  • Make ProjectKey part of BucketKey
  • Make aggregator a SystemService

Not implemented yet:

  • Measure how long every flush cycle takes
  • Get rid of Aggregator::queue, just iterate over Aggregator::buckets in every cycle.
  • In-process benchmark test of aggregator

https://getsentry.atlassian.net/browse/INGEST-302

#skip-changelog

@jjbayer
jjbayer marked this pull request as ready for review August 27, 2021 13:02
@jjbayer
jjbayer requested review from a team, RaduW and jan-auer August 27, 2021 13:02
Comment thread relay-metrics/src/aggregation.rs Outdated
self.receiver
.send(FlushBuckets::new(project_key, buckets))
.into_actor(self)
.and_then(clone!(project_key, |result, slf, _ctx| {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we double-check why this clone! is necessary? ProjectKey implements Copy, so in worst case a move closure should do.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I remember a quirk where Copy-values don't get copied but move the same way as Clone-values into the closure. however even then that shouldn't pose problems because there's no use after the closure and the one extra-use surely would behave like a regular Copy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

appears to be unnecessary

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.

3 participants