From 671129af3e343490e0fb277a2b0329aa3027fd73 Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Thu, 23 Jun 2022 16:09:16 +0200 Subject: [PATCH] rename prometheus metric name to include service name --- config.yaml | 19 ++++++++++++++++++- pyinfra/server/server.py | 5 +++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 2eb691d..067df8d 100755 --- a/config.yaml +++ b/config.yaml @@ -1,6 +1,6 @@ service: logging_level: $LOGGING_LEVEL_ROOT|DEBUG # Logging level for service logger - prometheus_metric_name: $PROMETHEUS_METRIC_NAME|operation # Default operation prometheus metric name + name: $SERVICE_NAME|research # Default service name for research service, used for prometheus metric name # target_file_extension: $TARGET_FILE_EXTENSION|"json.gz" # Extension for files to download from storage and process # TODO: will become obsolete by below changes @@ -14,6 +14,23 @@ service: input: subdir: "" extension: ORIGIN.pdf.gz + output: # FIXME + subdir: "conversion_new" # FIXME: currently operation string is sued for output dir + extension: json.gz + extraction: + input: + subdir: "" + extension: ORIGIN.pdf.gz + output: # FIXME + subdir: "extraction_new" # FIXME: currently operation string is sued for output dir + extension: json.gz + table_parsing: + input: + subdir: "conversion_new" + extension: json.gz + output: # FIXME + subdir: "table_new" # FIXME: currently operation string is sued for output dir + extension: json.gz default: input: subdir: "" diff --git a/pyinfra/server/server.py b/pyinfra/server/server.py index 1c9aa8b..7c7553a 100644 --- a/pyinfra/server/server.py +++ b/pyinfra/server/server.py @@ -59,8 +59,9 @@ def __set_up_processing_server(operation2function: Dict[str, QueuedStreamFunctio } def make_summary_instance(op: str): - op = op.replace("_pickup", "") if op != "pickup" else CONFIG.service.prometheus_metric_name - return Summary(f"redactmanager_{op}_seconds", f"Time spent on {op}.", registry=registry) + op = op.replace("_pickup", "") if op != "pickup" else "default" + service_name = CONFIG.service.name + return Summary(f"redactmanager_{service_name}_{op}_seconds", f"Time spent on {op}.", registry=registry) submit_operation2processor = {submit_suffix(op): prc for op, prc in operation2processor.items()} pickup_operation2processor = {pickup_suffix(op): prc for op, prc in operation2processor.items()}