Skip to content

enhancement: stale marker when series expire#7056

Draft
LucasMRC wants to merge 7 commits intografana:mainfrom
LucasMRC:lucasmrc/stale-marker
Draft

enhancement: stale marker when series expire#7056
LucasMRC wants to merge 7 commits intografana:mainfrom
LucasMRC:lucasmrc/stale-marker

Conversation

@LucasMRC
Copy link
Copy Markdown

@LucasMRC LucasMRC commented Apr 23, 2026

What this PR does:
sends a stale marker to remote write when a series is removed as stale

Which issue(s) this PR fixes:
closes #6494

Checklist

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

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Apr 23, 2026

CLA assistant check
All committers have signed the CLA.

@cla-assistant

This comment was marked as duplicate.

@LucasMRC LucasMRC force-pushed the lucasmrc/stale-marker branch 3 times, most recently from d64b106 to 4636e05 Compare April 24, 2026 08:27
@LucasMRC LucasMRC force-pushed the lucasmrc/stale-marker branch from d89612a to a3e8ddb Compare April 25, 2026 07:50
Comment on lines +476 to +481
if math.IsNaN(expected.v) {
// Check for stale marker
assert.True(t, math.IsNaN(actual.v))
} else {
assert.Equal(t, expected.v, actual.v)
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Now that the stale marker is being sent, the metric is not removed from the samples. I updated this so that I can test for the stale marker, but there's also the option to filter out stale markers in the capturingAppender.Append so that the sample would be removed as in the current test.

Comment on lines +185 to +189
if appender != nil {
_, err := appender.Append(0, s.labels, timeMs, math.Float64frombits(value.StaleNaN))
if err != nil {
errs = append(errs, err)
}
Copy link
Copy Markdown
Author

@LucasMRC LucasMRC Apr 25, 2026

Choose a reason for hiding this comment

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

I wasn't sure on how to handle errors in the updated removeStaleSeries functions, I copied the pattern that I saw in modules/generator/config.go.

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.

metrics-generator: send stale markers via remote write when series are removed from registry

1 participant