-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.py
More file actions
47 lines (44 loc) · 1.24 KB
/
Copy pathmetrics.py
File metadata and controls
47 lines (44 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Prometheus metrics for astronomical data fetches."""
from prometheus_client import Counter, Gauge, Histogram, start_http_server
FETCH_COUNTER = Counter(
"fetch_all_total",
"Total number of astronomical data fetches",
)
FETCH_ERRORS = Counter(
"fetch_errors_total",
"Total number of astronomical data fetch errors",
)
FETCH_DURATION = Histogram(
"fetch_duration_seconds",
"Duration of astronomical data fetches in seconds",
)
HTTP_REQUESTS = Counter(
"http_requests_total",
"Total HTTP requests made",
["method", "host", "path", "status_code"],
)
HTTP_REQUEST_EXCEPTIONS = Counter(
"http_request_exceptions_total",
"Total HTTP request exceptions",
["method", "host", "path", "exception_type"],
)
HTTP_REQUEST_DURATION = Histogram(
"http_request_duration_seconds",
"HTTP request latency in seconds",
["method", "host", "path"],
)
FORECAST_NEXT_HOUR_TEMPERATURE = Gauge(
"forecast_next_hour_temperature",
"Forecast temperature for 1 hour from now (°F)",
["location"],
)
__all__ = [
"FETCH_COUNTER",
"FETCH_ERRORS",
"FETCH_DURATION",
"HTTP_REQUESTS",
"HTTP_REQUEST_EXCEPTIONS",
"HTTP_REQUEST_DURATION",
"FORECAST_NEXT_HOUR_TEMPERATURE",
"start_http_server",
]