opni
opni copied to clipboard
Alerting Timeline (List Alarm messages)
Timeline API return types https://github.com/rancher/opni/blob/a542630c95138e7005747ca4eb4c558e16608921/pkg/apis/alerting/v1/alerting.condition.proto#L480-L493 now have an additional field that contains an array of fingerprints:
Sample output
{
"items": {
"Ak8vDnrUekfCgWvzKb4SBP": {
"windows": [
{
"start": "2023-03-08T19:08:18.672644298Z",
"end": "2023-03-08T19:10:08.662919079Z",
"type": "Timeline_Alerting",
"fingerprints": [
"1678302498"
]
}
]
},
"M5bev3nLNwDX3inZ4VGEn8": {
"windows": [
{
"start": "2023-03-07T20:58:20Z",
"end": "2023-03-08T19:50:00Z",
"fingerprints": [
"1678222700",
"1678302560",
"1678302740"
]
}
]
},
"WckFuA7FRkbp5siLsn7QKJ": {},
"zEQztDoYt8vEdnjCRyeftC": {
"windows": [
{
"start": "2023-03-07T20:59:27Z",
"end": "2023-03-08T19:50:00Z",
"fingerprints": [
"1678222767",
"1678302567"
]
}
]
}
}
}
/code>
There are used for the new api /AlertNotifications/alarms/list
: https://github.com/rancher/opni/blob/a542630c95138e7005747ca4eb4c558e16608921/pkg/apis/alerting/v1/alerting.notification.proto#L50. When a user clicks on a particular incident, the UI should make a call to this API to display relevant information, it accepts these incident intervals as input, for example:
{
"conditionId" : "M5bev3nLNwDX3inZ4VGEn8",
"start" : "2023-03-08T19:08:18.672644298Z",
"end" : "2023-03-08T19:10:08.662919079Z",
"fingerprints": [
"1678222700",
"1678302560",
"1678302740"
]
}
would return :
sample list message api return
{
"items": [
{
"receivedAt": "2023-03-08T19:13:50.613034849Z",
"lastUpdatedAt": "2023-03-08T19:42:58.392722732Z",
"notification": {
"title": "fingeprinted up?",
"body": "Prometheus query",
"properties": {
"OpniAlarmName": "fingeprinted up?",
"OpniCluster": "f2817a67-c685-4a25-b322-ec50e2cdbb1d",
"OpniGoldenSignal": "Custom",
"OpniHeader": "fingeprinted up?",
"OpniSummary": "Prometheus query",
"opni_fingerprint": ".01678302740.000000",
"opni_goldenSignal": "Custom",
"opni_promql": "M5bev3nLNwDX3inZ4VGEn8",
"opni_severity": "Info",
"opni_uuid": "M5bev3nLNwDX3inZ4VGEn8"
}
},
"startDetails": {
"alertname": "M5bev3nLNwDX3inZ4VGEn8",
"container": "gateway",
"endpoint": "8086",
"instance": "10.0.3.135:8086",
"job": "opni",
"namespace": "opni",
"pod": "opni-gateway-55846c45f8-d9vt8",
"prometheus": "opni/opni-prometheus-agent",
"prometheus_replica": "prometheus-opni-prometheus-agent-0",
"service": "opni"
},
"lastDetails": {
"alertname": "M5bev3nLNwDX3inZ4VGEn8",
"container": "all",
"endpoint": "http-metrics",
"instance": "10.0.8.182:8080",
"job": "cortex-ingester",
"namespace": "opni",
"pod": "cortex-all-0",
"prometheus": "opni/opni-prometheus-agent",
"prometheus_replica": "prometheus-opni-prometheus-agent-0",
"service": "cortex-ingester"
}
}
]
}
messages should be formatted so they include
- title
- body
- severity
- golden signal
- a dropdown with map string->string for all the startDetails
- a dropdown with map string->string for all the endDetails