From b3c52a2a958507dc1a2f8b250b3b6778738634d1 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Sun, 23 Apr 2023 13:08:06 +0300 Subject: [PATCH] add timestamp --- restic_exporter/restic_exporter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/restic_exporter/restic_exporter.py b/restic_exporter/restic_exporter.py index d3f4efd..f5ddff1 100644 --- a/restic_exporter/restic_exporter.py +++ b/restic_exporter/restic_exporter.py @@ -12,6 +12,7 @@ import json import click import click_config_file from logging.handlers import SysLogHandler +import time class restic_exporter: @@ -68,7 +69,9 @@ class restic_exporter: except Exception as error: self._log.error(f"# Error reading file '{json_file}'. Check permissions. {error}") - self.summary = {} + self.summary = { + "timestamp": time.time() + } for line in content: try: line_data = json.loads(line) @@ -142,7 +145,6 @@ class restic_exporter: case_sensitive=False, ), help='Set the debug level for the standard output.') @click.option('--log-file', '-l', help="File to store all debug messages.") -#@click.option("--dummy","-n" is_flag=True, help="Don't do anything, just show what would be done.") # Don't forget to add dummy to parameters of main function @click.option("--json-file", "-j", required=True, help='JSON file containing the output of restic') @click.option('--job-name', '-n', required=True, help='Restic job name to attach to the exported metrics') @click.option('--extra-labels', '-a', required=False, default=None, help='Pairs key=value separated by commas with extra labels to add to the summary')