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 metric name in limiter per-metric exceeded errors #6422

Merged
merged 4 commits into from
Dec 31, 2024

Conversation

eeldaly
Copy link
Contributor

@eeldaly eeldaly commented Dec 12, 2024

What this PR does:
Adds metric name in limiter per-metric exceeded errors

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

Checklist

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

CHANGELOG.md Outdated Show resolved Hide resolved
if actualLimit := l.maxSeriesPerMetric(userID); series < actualLimit {
return nil
}

return errMaxSeriesPerMetricLimitExceeded
return errors.Wrap(errMaxSeriesPerMetricLimitExceeded, "{metric name: " + metric + "}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change errMaxSeriesPerMetricLimitExceeded to take metric name as a parameter and we use errors.Wrapf(errMaxSeriesPerMetricLimitExceeded, metric)?

Copy link
Member

Choose a reason for hiding this comment

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

We already have the labels on the handleAppendFailure, no? we can just send those labels down to format the error?

Copy link
Member

Choose a reason for hiding this comment

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

Ex:

updateFirstPartial(func() error { return wrappedTSDBIngestErr(err, model.Time(timestampMs), lbls) })

@eeldaly eeldaly reopened this Dec 20, 2024
@eeldaly eeldaly requested a review from alanprot December 20, 2024 21:47
}

func (l *Limiter) formatMaxSeriesPerLabelSetError(err errMaxSeriesPerLabelSetLimitExceeded) error {
func (l *Limiter) formatMaxSeriesPerLabelSetError(err errMaxSeriesPerLabelSetLimitExceeded, lbls labels.Labels) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems not used. Do we need it?

}

func (l *Limiter) formatMaxMetadataPerUserError(userID string) error {
func (l *Limiter) formatMaxMetadataPerUserError(userID string, lbls labels.Labels) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems not used. Do we need it?

default:
return err
}
}

func (l *Limiter) formatMaxSeriesPerUserError(userID string) error {
func (l *Limiter) formatMaxSeriesPerUserError(userID string, lbls labels.Labels) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems not used. Do we need it?

@@ -158,16 +158,16 @@ func (l *Limiter) formatMaxSeriesPerUserError(userID string) error {
minNonZero(localLimit, globalLimit), l.AdminLimitMessage, localLimit, globalLimit, actualLimit)
}

func (l *Limiter) formatMaxSeriesPerMetricError(userID string) error {
func (l *Limiter) formatMaxSeriesPerMetricError(userID string, lbls labels.Labels) error {
actualLimit := l.maxSeriesPerMetric(userID)
Copy link
Contributor

Choose a reason for hiding this comment

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

We can just pass the metric name string. No need to pass labels

@eeldaly eeldaly requested a review from yeya24 December 23, 2024 20:46
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.

LGTM. Let's fix lint

eeldaly and others added 2 commits December 23, 2024 15:31
Signed-off-by: Essam Eldaly <[email protected]>
Copy link
Member

@alanprot alanprot left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 31, 2024
@yeya24 yeya24 merged commit d41ad75 into cortexproject:master Dec 31, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ingester lgtm This PR has been approved by a maintainer size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include metric name in max series per metric limit exceeded error
3 participants