Refactor OPC metrics to use unpacking for CORE_LABELS in metrics.py - Updated the definition of prediction OPC writing metrics to utilize unpacking for CORE_LABELS, enhancing code clarity and maintainability.
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from prometheus_client import Gauge, Counter, Histogram
|
|
|
|
APP_UP = Gauge(
|
|
"app_up",
|
|
"Indicates if the application is running (1) or shutting down (0)",
|
|
["pod_id"],
|
|
)
|
|
|
|
CORE_LABELS = ["pod_id", "model_name", "pipeline_name"]
|
|
|
|
PREDICTIONS_WRITTEN_COUNT = Counter(
|
|
"laborious_predictions_written_count",
|
|
"Number of predictions written to the database table predictions",
|
|
CORE_LABELS,
|
|
)
|
|
|
|
PREDICTION_CONFIDENCE_MONITOR = Gauge(
|
|
"laborious_prediction_confidence_monitor",
|
|
"Current confidence of each prediction",
|
|
CORE_LABELS,
|
|
)
|
|
|
|
PREDICTION_RESPONSE_TIME_MONITOR = Histogram(
|
|
"laborious_prediction_response_time_monitor",
|
|
"Current response time of each prediction",
|
|
CORE_LABELS,
|
|
buckets=[0.01, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0]
|
|
)
|
|
|
|
PREDICTION_OPC_WRITING_COUNT = Counter(
|
|
"laborious_prediction_opc_writing_count",
|
|
"Number of predictions written to the OPC server",
|
|
[*CORE_LABELS, "opc_server_id"],
|
|
)
|
|
|
|
PREDICTION_OPC_WRITING_RESPONSE_TIME_MONITOR = Histogram(
|
|
"laborious_prediction_opc_writing_response_time_monitor",
|
|
"Current response time of each prediction written to the OPC server",
|
|
[*CORE_LABELS, "opc_server_id"],
|
|
buckets=[0.01, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0]
|
|
)
|