Skip to content

fix: Reset lag for index builder when partitions change - #20825

Merged
DylanGuedes merged 7 commits into
mainfrom
fix-index-builder-lag-report
Feb 19, 2026
Merged

fix: Reset lag for index builder when partitions change#20825
DylanGuedes merged 7 commits into
mainfrom
fix-index-builder-lag-report

Conversation

@DylanGuedes

@DylanGuedes DylanGuedes commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
As of now, there's some especial cases where index builders don't receive data for too long after a partition is revoked, causing excessive lag to be showing up even though it isn't really happening. I'm fixing that by resetting the lag on partitions revoking. Because I don't want to reset lags for all partitions at once, I had to add a new partition label, so that I can reset the lag only for that partition.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
@DylanGuedes
DylanGuedes requested a review from a team as a code owner February 16, 2026 15:05
@DylanGuedes
DylanGuedes force-pushed the fix-index-builder-lag-report branch from 5444735 to fcd2f15 Compare February 16, 2026 23:14
@pull-request-size pull-request-size Bot added size/S and removed size/L labels Feb 16, 2026

@joe-elliott joe-elliott left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

really like splitting this out by partition, but we've confirmed this won't impact any dashboards or alerts we have on this metric?

Comment thread pkg/dataobj/index/metrics.go Outdated
// Convert milliseconds to seconds and calculate delay
if !recordTimestamp.IsZero() { // Only observe if timestamp is valid
p.processingDelay.Set(time.Since(recordTimestamp).Seconds())
p.processingDelay.WithLabelValues(fmt.Sprintf("%d", partition)).Set(time.Since(recordTimestamp).Seconds())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

strconv.itoa?

seems a bit more direct than using fmt.Sprintf. same thought below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nice, applied

@DylanGuedes

Copy link
Copy Markdown
Contributor Author

really like splitting this out by partition, but we've confirmed this won't impact any dashboards or alerts we have on this metric?

if it does I fix it 😄

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Feb 18, 2026
@DylanGuedes
DylanGuedes merged commit b9af4f5 into main Feb 19, 2026
90 checks passed
@DylanGuedes
DylanGuedes deleted the fix-index-builder-lag-report branch February 19, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants