Преглед изворни кода

Replace LF with two spaces

Grafana v8.0.0 and newer (AlertingNG) changed the message format and sends a multi-line string.
master
JustAnotherArchivist пре 2 година
родитељ
комит
e9a9b74599
1 измењених фајлова са 2 додато и 1 уклоњено
  1. +2
    -1
      contrib/modules/grafana.py

+ 2
- 1
contrib/modules/grafana.py Прегледај датотеку

@@ -5,6 +5,7 @@ async def process(request):
obj = json.loads(await request.text())
evalMatchesStr = (': ' + ', '.join(f'{x["metric"]} = {x["value"]}' for x in obj['evalMatches'])) if 'evalMatches' in obj and obj['evalMatches'] else ''
if 'message' in obj:
return f'{obj["title"]} - {obj["message"]}{evalMatchesStr}'
message = obj['message'].replace('\n', ' ')
return f'{obj["title"]} - {message}{evalMatchesStr}'
else:
return f'{obj["title"]}{evalMatchesStr}'

Loading…
Откажи
Сачувај