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

Add users stats http api to ingester #6178

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

danielblando
Copy link
Contributor

@danielblando danielblando commented Aug 28, 2024

What this PR does:
As mentioned in the feature, it would be nice if we know ingesters are empty to safely scale it down.
This extends the existent api on distributors /distributors/all_user_stats to also ingesters /ingester/all_user_stats.
It was also added to the api the info about Loaded blocks which can be used to scale down ingesters.

Example of the API on ingester
Screenshot 2024-08-27 at 11 47 24 PM

Which issue(s) this PR fixes:
Fixes #6144

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>
Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>
@danielblando danielblando marked this pull request as ready for review August 28, 2024 03:55
@danielblando danielblando requested review from alanprot and friedrichg and removed request for alanprot August 28, 2024 14:55
APIIngestionRate float64 `json:"APIIngestionRate"`
RuleIngestionRate float64 `json:"RuleIngestionRate"`
ActiveSeries uint64 `json:"activeSeries"`
LoadBlocks uint64 `json:"loadBlocks"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unclear to me. I see it just uses db.Blocks(). Does it include head block as well?
How we gonna use this data to help with scale down. Do we check LoadBlocks==0?

Copy link
Member

Choose a reason for hiding this comment

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

This should be "loadedBlocks" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, these are blocks loaded from disk. Head is not really a block yet. The check is more LoadBlocks == 0 && ActiveSeries == 0. I did a revision adding a +1 to loaded blocks to count for the head, but it seems more a hack than what it should be.

I will change the naming for LoadedBlocks, but i would leave it without the head

pkg/api/api.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>
@danielblando
Copy link
Contributor Author

Added api docs

Screenshot 2024-09-02 at 6 06 56 PM

Signed-off-by: Daniel Blando <daniel@blando.com.br>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>
@danielblando danielblando merged commit c6048fa into cortexproject:master Sep 3, 2024
16 checks passed
@danielblando danielblando deleted the ingesterBlocks branch September 3, 2024 14:02
danielblando added a commit to danielblando/cortex that referenced this pull request Sep 3, 2024
* Add users stats http api to ingester

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>

* Changelog

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>

* Change name for loadedBlocks

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>

---------

Signed-off-by: Daniel Deluiggi <ddeluigg@amazon.com>
Signed-off-by: Daniel Blando <daniel@blando.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alternative to scaling down ingesters
3 participants