feat(alerts): fix webhook json-serialization issue
This commit is contained in:
parent
0267532081
commit
49a240612c
4 changed files with 13 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from decouple import config
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from starlette.responses import StreamingResponse
|
||||
|
|
@ -65,5 +66,5 @@ for job in core_crons.cron_jobs + core_dynamic_crons.cron_jobs:
|
|||
for job in Schedule.get_jobs():
|
||||
print({"Name": str(job.id), "Run Frequency": str(job.trigger), "Next Run": str(job.next_run_time)})
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger('apscheduler').setLevel(logging.INFO)
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
logging.getLogger('apscheduler').setLevel(config("LOGLEVEL", default=logging.INFO))
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ app.schedule.start()
|
|||
app.schedule.add_job(id="alerts_processor", **{"func": alerts_processor.process, "trigger": "interval",
|
||||
"minutes": config("ALERTS_INTERVAL", cast=int, default=5),
|
||||
"misfire_grace_time": 20})
|
||||
|
||||
for job in app.schedule.get_jobs():
|
||||
print({"Name": str(job.id), "Run Frequency": str(job.trigger), "Next Run": str(job.next_run_time)})
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger('apscheduler').setLevel(logging.INFO)
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
logging.getLogger('apscheduler').setLevel(config("LOGLEVEL", default=logging.INFO))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import decimal
|
||||
import logging
|
||||
|
||||
import schemas
|
||||
|
|
@ -224,7 +225,10 @@ def process():
|
|||
"sourceMeta": alert["detectionMethod"],
|
||||
"message": alert["options"]["message"], "projectId": alert["projectId"],
|
||||
"data": {"title": alert["name"],
|
||||
"limitValue": alert["query"]["right"], "actualValue": result["value"],
|
||||
"limitValue": alert["query"]["right"],
|
||||
"actualValue": float(result["value"]) \
|
||||
if isinstance(result["value"], decimal.Decimal) \
|
||||
else result["value"],
|
||||
"operator": alert["query"]["operator"],
|
||||
"trigger": alert["query"]["left"],
|
||||
"alertId": alert["alertId"],
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import logging
|
|||
import queue
|
||||
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from decouple import config
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from starlette import status
|
||||
|
|
@ -81,5 +82,5 @@ app.schedule.add_job(id="trace_worker", **traces.cron_jobs[0])
|
|||
for job in app.schedule.get_jobs():
|
||||
print({"Name": str(job.id), "Run Frequency": str(job.trigger), "Next Run": str(job.next_run_time)})
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger('apscheduler').setLevel(logging.INFO)
|
||||
logging.basicConfig(level=config("LOGLEVEL", default=logging.INFO))
|
||||
logging.getLogger('apscheduler').setLevel(config("LOGLEVEL", default=logging.INFO))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue