chore: Move logging to info level

- Extracted values are set to info level
- Full API response is still set to debug level

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2022-05-14 11:46:15 +02:00
parent 9af285c49d
commit 15f3746f2e
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7

View file

@ -202,29 +202,29 @@ class Trex(Resource):
if "hashrate" in data: if "hashrate" in data:
hashrate = data["hashrate"] hashrate = data["hashrate"]
logger.debug(f"Hashrate is {hashrate}") logger.info(f"Hashrate is {hashrate}")
metrics.append(Metric("hashrate", hashrate, context="hashrate")) metrics.append(Metric("hashrate", hashrate, context="hashrate"))
if "success" in data: if "success" in data:
success = bool(data["success"]) success = bool(data["success"])
if success: if success:
logger.debug("T-Rex is successfully started") logger.info("T-Rex is successfully started")
else: else:
logger.debug("T-Rex is not successfully started") logger.info("T-Rex is not successfully started")
metrics.append(Metric("success", success, context="success")) metrics.append(Metric("success", success, context="success"))
if "paused" in data: if "paused" in data:
paused = bool(data["paused"]) paused = bool(data["paused"])
if paused: if paused:
logger.debug("T-Rex is paused") logger.info("T-Rex is paused")
else: else:
logger.debug("T-Rex is not paused") logger.info("T-Rex is not paused")
metrics.append(Metric("paused", paused, context="paused")) metrics.append(Metric("paused", paused, context="paused"))
if "uptime" in data: if "uptime" in data:
uptime = data["uptime"] uptime = data["uptime"]
seconds = "seconds" if uptime > 1 else "second" seconds = "seconds" if uptime > 1 else "second"
logger.debug(f"Uptime is {uptime} {seconds}") logger.info(f"Uptime is {uptime} {seconds}")
metrics.append(Metric("uptime", uptime, context="uptime")) metrics.append(Metric("uptime", uptime, context="uptime"))
for gpu in data.get("gpus"): for gpu in data.get("gpus"):
@ -233,15 +233,15 @@ class Trex(Resource):
if "temperature" in gpu: if "temperature" in gpu:
temperature = gpu["temperature"] temperature = gpu["temperature"]
logger.debug(f"Temperature of {name} ({id}) is {temperature}C") logger.info(f"GPU {id} ({name}): temperature is {temperature}C")
metrics.append( metrics.append(
Metric(f"temperature_{id}", temperature, context="temperature") Metric(f"temperature_{id}", temperature, context="temperature")
) )
if "memory_temperature" in gpu: if "memory_temperature" in gpu:
memory_temperature = gpu["memory_temperature"] memory_temperature = gpu["memory_temperature"]
logger.debug( logger.info(
f"Memory temperature of {name} ({id}) is {memory_temperature}C" f"GPU {id} ({name}): memory temperature is {memory_temperature}C"
) )
metrics.append( metrics.append(
Metric( Metric(