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 metrics to track ingesting native histograms #6370

Merged

Conversation

SungJin1212
Copy link
Contributor

@SungJin1212 SungJin1212 commented Nov 25, 2024

This PR adds two ingester metrics cortex_ingester_ingested_native_histograms_total and cortex_ingester_ingested_native_histograms_failures_total to track ingesting native histogram.

Which issue(s) this PR fixes:
Fixes #

Checklist

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

@SungJin1212 SungJin1212 force-pushed the Track-native-histogram-in-ingester branch 2 times, most recently from 021bc82 to 2e01fdb Compare November 25, 2024 03:09
@SungJin1212 SungJin1212 force-pushed the Track-native-histogram-in-ingester branch from 2e01fdb to d39de75 Compare November 25, 2024 04:05
}

// Distributor counts both samples, metadata and histograms, so for consistency ingester does the same.
i.ingestionRate.Add(int64(succeededSamplesCount + ingestedMetadata))
i.ingestionRate.Add(int64(succeededSamplesCount + succeededHistogramCount + ingestedMetadata))

switch req.Source {
case cortexpb.RULE:
db.ingestedRuleSamples.Add(int64(succeededSamplesCount))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we don't update this?

@@ -1400,7 +1413,7 @@ func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
if errors.As(firstPartialErr, &ve) {
code = ve.code
}
level.Debug(logutil.WithContext(ctx, i.logger)).Log("msg", "partial failures to push", "totalSamples", succeededSamplesCount+failedSamplesCount, "failedSamples", failedSamplesCount, "firstPartialErr", firstPartialErr)
level.Debug(logutil.WithContext(ctx, i.logger)).Log("msg", "partial failures to push", "totalSamples", succeededSamplesCount+succeededHistogramCount+failedSamplesCount+failedHistogramCount, "failedSamples", failedSamplesCount, "failedHistogram", failedHistogramCount, "firstPartialErr", firstPartialErr)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to separate out samples and histograms then let's add a dedicated totalHistograms.

failedHistogram => failedHistograms

// we must already have copied the labels if succeededHistogramCount has been incremented.
return copiedLabels
})
}
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 combine this part with the code above so that we only update series once?

shouldUpdateSeries := (succeededSamplesCount > oldSucceededSamplesCount) || (succeededHistogramCount > oldSucceededHistogramsCount)
if i.cfg.ActiveSeriesMetricsEnabled && shouldUpdateSeries {...}

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 introduce a variable instead? To avoid the line to be too long

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

@SungJin1212 SungJin1212 force-pushed the Track-native-histogram-in-ingester branch 3 times, most recently from 2defe54 to 2fb3ec3 Compare November 25, 2024 05:02
@SungJin1212 SungJin1212 requested a review from yeya24 November 25, 2024 05:06
@SungJin1212 SungJin1212 force-pushed the Track-native-histogram-in-ingester branch from 2fb3ec3 to 49a2cbc Compare November 26, 2024 00:07
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!

@SungJin1212
Copy link
Contributor Author

@alanprot
Could you take a look? :D

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 Nov 26, 2024
@alanprot alanprot merged commit 48049d4 into cortexproject:master Nov 26, 2024
16 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/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants