From 0f1441163a37fc7a31db350d5f780f18821318db Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Mon, 19 Feb 2024 10:01:38 +0100 Subject: [PATCH] Download counter metrics --- amarillo/plugins/metrics/metrics.py | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/amarillo/plugins/metrics/metrics.py b/amarillo/plugins/metrics/metrics.py index 6f106a1..0ad3eff 100644 --- a/amarillo/plugins/metrics/metrics.py +++ b/amarillo/plugins/metrics/metrics.py @@ -21,6 +21,15 @@ logger = logging.getLogger(__name__) security = HTTPBasic() +gtfs_download_counter = Counter("gtfs_downloads", "How many times GTFS data was downloaded") +grfs_download_counter = Counter("grfs_downloads", "How many times GRFS data was downloaded") + +def increment_gtfs_download_counter(): + gtfs_download_counter.inc() + +def increment_grfs_download_counter(): + grfs_download_counter.inc() + def amarillo_trips_number_total() -> Callable[[Info], None]: METRIC = Gauge("amarillo_trips_number_total", "Total number of trips.") diff --git a/pyproject.toml b/pyproject.toml index e6eadb4..7ffef78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "amarillo-metrics" -version = "0.0.5" +version = "0.0.6" description = "Prometheus metrics for Amarillo" readme = "README.md" license = {file = "LICENSE"}