elstat.adapters: only log on errors
always logging was giving quite the disk usage on prod.
This commit is contained in:
parent
9f5d42c89c
commit
867d7d1e69
1 changed files with 7 additions and 4 deletions
|
@ -66,12 +66,13 @@ class PingAdapter(Adapter):
|
||||||
else:
|
else:
|
||||||
latency = 0
|
latency = 0
|
||||||
|
|
||||||
worker.log.info(f'alive={alive} latency={latency}ms')
|
|
||||||
|
|
||||||
if alive:
|
if alive:
|
||||||
# we dont need to keep sending err_msg on alive scenarios
|
# we dont need to keep sending err_msg on alive scenarios
|
||||||
return cls._construct(alive, latency)
|
return cls._construct(alive, latency)
|
||||||
|
|
||||||
|
# only log on errors
|
||||||
|
worker.log.info(f'alive={alive} latency={latency}ms')
|
||||||
|
|
||||||
err = PING_ERROR_RGX.search(out)
|
err = PING_ERROR_RGX.search(out)
|
||||||
err_msg = err.group(2) if not alive and err else 'packet lost'
|
err_msg = err.group(2) if not alive and err else 'packet lost'
|
||||||
|
|
||||||
|
@ -110,9 +111,11 @@ class HttpAdapter(Adapter):
|
||||||
# drop latency to 0 to signal a non-success
|
# drop latency to 0 to signal a non-success
|
||||||
latency = latency if succ else 0
|
latency = latency if succ else 0
|
||||||
|
|
||||||
worker.log.info(f'status={resp.status} latency={latency}ms')
|
|
||||||
|
|
||||||
if not succ:
|
if not succ:
|
||||||
|
# only log on errors
|
||||||
|
worker.log.info(f'status={resp.status} latency={latency}ms')
|
||||||
|
|
||||||
|
# construct error message from http error code
|
||||||
status_phrase = cls.get_phrase(resp.status)
|
status_phrase = cls.get_phrase(resp.status)
|
||||||
err_str = f'http status {resp.status} - {status_phrase}'
|
err_str = f'http status {resp.status} - {status_phrase}'
|
||||||
return cls._construct(succ, latency, err_str)
|
return cls._construct(succ, latency, err_str)
|
||||||
|
|
Loading…
Reference in a new issue