Add arbitrary key/value data store to the nflog#4899
Merged
SuperQ merged 4 commits intoprometheus:mainfrom Jan 28, 2026
Merged
Conversation
846ec9e to
4c74f25
Compare
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
4c74f25 to
0ab5b64
Compare
siavashs
reviewed
Jan 19, 2026
siavashs
approved these changes
Jan 19, 2026
Contributor
siavashs
left a comment
There was a problem hiding this comment.
Added minor suggestions, but otherwise LGTM 👍
I also ran some code analysis on the tests and the recommendation was to add the following test cases:
// Test: Transition from resolved-only to firing alerts should clear receiver data
// Test: Entry with firing alerts should preserve receiver data
// Test: Verify NflogStore contains expected data based on entry state
Contributor
Author
I think I do have tests for each of these:
But I'm very happy to add some more test cases if something's missing here |
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
8206e21 to
6cf19bd
Compare
ultrotter
reviewed
Jan 21, 2026
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
Signed-off-by: Ethan Hunter <ehunter@hudson-trading.com>
92a998f to
d2b81ef
Compare
ultrotter
approved these changes
Jan 22, 2026
Merged
This was referenced Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds a new
receiver_datafield to the nflog entry protobuf message.receiver_datais astring -> int|double|stringmap.Integrations can interact with receiver data using the new
nflog.Storestruct which acts like a mutable persistent key/value store. Every time the notifier is called, the context contains a*nflog.Storewith any data set by previous runs of the notifier. Since the data is sourced from the nflog, everything works as expected in HA mode and through restarts.I've chosen to support single key/value pairs (as opposed to
key -> bytesor just a rawbytesfield to reduce complexity for the notifier. Nflog entries are persisted through restarts and upgrades, so it's important to avoid breaking backwards compatibility. Short of making every integration specify its own proto, we don't have a good way to avoid compatibility breaks. I think keeping the scope of custom data more limited will help discourage storing complicated structures in the nflog.The nflog store is automatically cleared after an nflog message containing only resolved alerts. This allows "new" notifications to start from a fresh store. If a notifier doesn't mutate the store, the old values are persisted into the next nflog entry.
Using the store is optional and easy:
In HRT, we use this system for storing the first notification's Slack
thread_tsin our slack notifier. This allows future notifications to update the existing message or respond in the thread. I haven't included any uses of the store in this PR since HRT's slack notifier is a whole different can of worms.