diff --git a/config.yaml b/config.yaml index 7f8cafa..4a52b80 100755 --- a/config.yaml +++ b/config.yaml @@ -7,7 +7,7 @@ service: response_folder: $RESPONSE_FOLDER|null # Specifies, how to handle the `page` key of a request. "multi" will download all pages matching the list of pages # specified in the request - download_strategy: single + download_strategy: $DOWNLOAD_STRATEGY|single probing_webserver: host: $PROBING_WEBSERVER_HOST|"0.0.0.0" # Probe webserver address diff --git a/pyinfra/server/server.py b/pyinfra/server/server.py index 65396f7..8e471f4 100644 --- a/pyinfra/server/server.py +++ b/pyinfra/server/server.py @@ -52,14 +52,15 @@ def __set_up_processing_server_impl(operation2function: Dict[str, QueuedStreamFu op: LazyRestProcessor(fn, **build_endpoint_suffixes(op)) for op, fn in operation2function.items() } - def make_summary_instance(op): + def make_summary_instance(op: str): + op = op.replace("_pickup", "") return Summary(f"redactmanager_{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()} operation2processor = merge(submit_operation2processor, pickup_operation2processor) - operation2metric = {op: make_summary_instance(op) for op in operation2processor} + operation2metric = {op: make_summary_instance(op) for op in pickup_operation2processor} @app.route("/ready", methods=["GET"]) def ready(): @@ -83,7 +84,7 @@ def __set_up_processing_server_impl(operation2function: Dict[str, QueuedStreamFu @app.route("/", methods=["GET"]) def pickup(operation): - with operation2metric[operation.replace("_pickup", "")].time(): + with operation2metric[operation].time(): return operation2processor[operation].pop() return app