feat(grafana-oncall): add custom_json parameter for custom payloads#6269
Open
ningyang1988 wants to merge 2 commits intokeephq:mainfrom
Open
feat(grafana-oncall): add custom_json parameter for custom payloads#6269ningyang1988 wants to merge 2 commits intokeephq:mainfrom
ningyang1988 wants to merge 2 commits intokeephq:mainfrom
Conversation
Allow users to pass a custom JSON payload (dict or string) to the Grafana OnCall provider, bypassing the default field mapping. - Add custom_json parameter to _notify (dict | str | None) - When provided, send custom payload directly to OnCall webhook - Supports both dict objects and JSON string inputs - Update provider documentation with usage examples - Add unit tests for all custom_json code paths Closes keephq#5316
Author
|
I have signed the CLA |
8a0b5d4 to
dd3d1d5
Compare
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.
Summary
Adds support for a
custom_jsonparameter in the Grafana OnCall provider's_notifymethod, as requested in #5316.Problem
Currently, the Grafana OnCall provider only sends a fixed set of fields (
title,message,alert_uid,image_url,state,link_to_upstream_details). Grafana OnCall supports custom templating and arbitrary key/value pairs in webhook payloads, but there was no way to pass custom fields through Keep.Solution
custom_jsonparameter (type:dict | str | None) to_notifycustom_jsonis provided:custom_jsonisNone(default), the existing behavior is unchangedChanges
keep/providers/grafana_oncall_provider/grafana_oncall_provider.py: Addcustom_jsonparameter and payload routing logicdocs/providers/documentation/grafana_oncall-provider.mdx: Add "Custom JSON Payload" section with examplesdocs/snippets/providers/grafana_oncall-snippet-autogenerated.mdx: Addcustom_jsonto parameter listtests/providers/grafana_oncall_provider/test_grafana_oncall_custom_json.py: Unit tests covering all code pathsTesting
All 5 unit tests pass:
Usage
Closes #5316