瀏覽代碼

Remove trailing colon on empty evalMatches

master
JustAnotherArchivist 3 年之前
父節點
當前提交
e4946a6b3c
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. +1
    -1
      contrib/modules/grafana.py

+ 1
- 1
contrib/modules/grafana.py 查看文件

@@ -3,7 +3,7 @@ import json

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 else ''
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}'
else:


Loading…
取消
儲存