mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-25 15:23:43 +03:00
don't push metrics if INFLUX_HOST not provided
This commit is contained in:
parent
ce2a6d5bdd
commit
f1577271df
|
@ -7,7 +7,9 @@ from ..config import (INFLUX_DB, INFLUX_HOST, INFLUX_PASSWORD, INFLUX_PORT,
|
||||||
|
|
||||||
|
|
||||||
async def push_metric(measurement, tags: Dict, fields: Dict):
|
async def push_metric(measurement, tags: Dict, fields: Dict):
|
||||||
try:
|
if INFLUX_HOST is None:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
point = {
|
point = {
|
||||||
'measurement': measurement,
|
'measurement': measurement,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
|
@ -22,9 +24,6 @@ async def push_metric(measurement, tags: Dict, fields: Dict):
|
||||||
mode='async'
|
mode='async'
|
||||||
) as client:
|
) as client:
|
||||||
await client.write(point)
|
await client.write(point)
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
async def push_api_request_status(status_code: int, endpoint: str):
|
async def push_api_request_status(status_code: int, endpoint: str):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user