mirror of
https://github.com/netinvent/npbackup.git
synced 2024-11-10 09:03:02 +08:00
Don't write metrics file in dry run mode
This commit is contained in:
parent
345a1eff52
commit
368f857723
1 changed files with 5 additions and 5 deletions
|
@ -131,7 +131,9 @@ def metric_writer(
|
|||
pass
|
||||
|
||||
logger.debug("Metrics computed:\n{}".format("\n".join(metrics)))
|
||||
if destination:
|
||||
if destination and dry_run:
|
||||
logger.info("Dry run mode. Not sending metrics.")
|
||||
elif destination:
|
||||
logger.debug("Sending metrics to {}".format(destination))
|
||||
dest = destination.lower()
|
||||
if dest.startswith("http"):
|
||||
|
@ -153,10 +155,8 @@ def metric_writer(
|
|||
except KeyError:
|
||||
logger.info("No metrics authentication present.")
|
||||
authentication = None
|
||||
if not dry_run:
|
||||
|
||||
upload_metrics(destination, authentication, no_cert_verify, metrics)
|
||||
else:
|
||||
logger.info("Not uploading metrics in dry run mode")
|
||||
else:
|
||||
try:
|
||||
# We use append so if prometheus text collector did not get data yet, we'll not wipe it
|
||||
|
|
Loading…
Reference in a new issue