Parse example alert payload to return list of payload alert fields
Contributes to #262707 (closed)
Create a GraphQL query which receives a example alert payload (JSON) and returns a list of possible payload alert fields to shown in a dropdown of the custom mapping UI.
Input
- Project path
- Used to check user permissions and license
- example payload (JSON)
query {
project(fullPath: "root/manual_prometheus") {
alertManagementPayloadFields(payload: <SAMPLE PAYLOAD JSON>) {
path
label
type
}
}
}
Result
- Payload alert keys:
[
{
"path": ["foo", "bar"],
"type": "string",
"label": "Bar"
},
...
]
Note that the result is not stored on the server and is transient.
Caveat about pagination
We are limiting the total amount of returned alert keys to 100 because we are not implementing GraphQL pagination.
Edited by Peter Leitzen