don't push metrics if INFLUX_HOST not provided

This commit is contained in:
kiriharu 2021-03-31 09:44:08 +03:00
parent ce2a6d5bdd
commit f1577271df

View File

@ -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):