GTFS file size metric
All checks were successful
Amarillo/amarillo-gitea/amarillo-metrics/pipeline/head This commit looks good
All checks were successful
Amarillo/amarillo-gitea/amarillo-metrics/pipeline/head This commit looks good
This commit is contained in:
parent
ff1776e015
commit
3837f968aa
|
|
@ -30,6 +30,24 @@ def amarillo_trips_number_total() -> Callable[[Info], None]:
|
|||
|
||||
return instrumentation
|
||||
|
||||
def amarillo_gtfs_file_size() -> Callable[[Info], None]:
|
||||
METRIC = Gauge("amarillo_gtfs_file_size_MB", "Total file size of GTFS data.")
|
||||
|
||||
def instrumentation(info: Info) -> None:
|
||||
total_size = sum(os.path.getsize(os.path.join(path, file)) for path, dirnames, files in os.walk("./data/gtfs") for file in files)
|
||||
METRIC.set(total_size/1_000_000)
|
||||
|
||||
return instrumentation
|
||||
|
||||
def amarillo_grfs_file_size() -> Callable[[Info], None]:
|
||||
METRIC = Gauge("amarillo_grfs_file_size_MB", "Total file size of GRFS data.")
|
||||
|
||||
def instrumentation(info: Info) -> None:
|
||||
total_size = sum(os.path.getsize(os.path.join(path, file)) for path, dirnames, files in os.walk("./data/grfs") for file in files)
|
||||
METRIC.set(total_size/1_000_000)
|
||||
|
||||
return instrumentation
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/metrics",
|
||||
|
|
@ -59,6 +77,8 @@ def setup(app: FastAPI):
|
|||
instrumentator = Instrumentator().instrument(app)
|
||||
instrumentator.add(pfi_metrics.default())
|
||||
instrumentator.add(amarillo_trips_number_total())
|
||||
instrumentator.add(amarillo_gtfs_file_size())
|
||||
instrumentator.add(amarillo_grfs_file_size())
|
||||
|
||||
|
||||
instrumentator.instrument(app)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "amarillo-metrics"
|
||||
version = "0.0.4"
|
||||
version = "0.0.5"
|
||||
description = "Prometheus metrics for Amarillo"
|
||||
readme = "README.md"
|
||||
license = {file = "LICENSE"}
|
||||
|
|
|
|||
Reference in a new issue