Skip to content

Commit

Permalink
Merge pull request #28 from IATI/zipper_prom_metric
Browse files Browse the repository at this point in the history
ops: added zipper duration as prom metric
  • Loading branch information
simon-20 authored Dec 11, 2024
2 parents 44f6459 + 005f40b commit d0873d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The example file is preconfigured to work with the local docker compose setup.

#### 4. Install some version of `dotenv` (optional)

The `.env` file is used when running things locally to store environment variables that configure the apps mentioned above. Docker Compose will read this automatically, but when running the bulk data service app or `yoyo` directly, you need to get these variables into the shell environment: you can either source this file to get the environment variables into your current terminal context, or you can one of the various `dotenv` command line tools to import the environment on each run (using `dotenv` lets you quickly switch different `.env` files in and out, which can be useful for testing, debugging, etc).
The `.env` file is used when running things locally to store environment variables that configure the apps mentioned above. Docker Compose will read this automatically, but when running the bulk data service app or `yoyo` directly, you need to get these variables into the shell environment: you can either source this file to get the environment variables into your current terminal context, or you can use one of the various `dotenv` command line tools to import the environment on each run (using `dotenv` lets you quickly switch different `.env` files in and out, which can be useful for testing, debugging, etc).

### Running after first-time setup

Expand Down
1 change: 1 addition & 0 deletions src/bulk_data_service/zipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def zipper_run(context: dict, datasets_in_working_dir: dict[uuid.UUID, dict], da

run_end = datetime.datetime.now(datetime.UTC)
context["logger"].info("Zipper run finished in {}.".format(run_end - run_start))
context["prom_metrics"]["zipper_run_duration"].set((run_end - run_start).seconds)


def setup_working_dir_with_downloaded_datasets(
Expand Down
4 changes: 4 additions & 0 deletions src/utilities/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def get_metrics_definitions(context: dict) -> list:
"checker_run_duration",
"The time taken by the last run of the checker (seconds)",
),
(
"zipper_run_duration",
"The time taken by the last run of the zipper (seconds)",
),
(
"number_crashes",
"The number of crashes since app restart",
Expand Down

0 comments on commit d0873d1

Please sign in to comment.