Skip to content

feat(rule): support humanizeDuration in annotations - #14

Draft
andrewloux wants to merge 1 commit into
mainfrom
andrewloux/humanize-duration
Draft

andrewloux wants to merge 1 commit into
mainfrom
andrewloux/humanize-duration

Conversation

@andrewloux

Copy link
Copy Markdown

duration annotations currently print raw seconds. this adds humanizeDuration, so a query value of 4800 can render as 1h 20m 0s

the renderer registers Prometheus's existing HumanizeDuration helper before parsing annotation templates. prometheus/common becomes a direct dependency at its existing version

templates can use {{ $value | humanizeDuration }} or {{ humanizeDuration .Value }}. query values stay in seconds, and changing the formatted duration keeps the same alert identity

tests render complete pod summaries across minutes, hours, and days using both syntaxes. the README documents the helper and its units

validated with go vet ./..., the CI package test suite with -race -count=1, and a binary build. consumers must deploy this release before adding the helper to rule annotations

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.

1 participant