SIENTIAPDE-1083: add prometheus metrics to opc_manager.

This commit is contained in:
Bruno Domingues
2025-05-29 16:52:10 -03:00
parent 03ed5784b1
commit c49f04ded6
6 changed files with 354 additions and 203 deletions

View File

@@ -1,11 +1,7 @@
from prometheus_client import Counter, Gauge, Histogram
# It's useful to have a common set of labels, like the pod_id.
# We'll add 'pod_id' to many metrics to distinguish instances.
POD_ID_LABEL = ["pod_id"]
SERVER_LABELS = ["pod_id", "server_name", "server_url"]
SLOT_LABELS = ["pod_id", "slot_id"]
TAG_LABELS = ["pod_id", "server_name", "tag_id", "tag_name"]
KAFKA_LABELS = ["pod_id", "topic"]
REDIS_LABELS = ["pod_id", "operation"]
NOTIFICATION_LABELS = ["pod_id", "level", "block"]
@@ -37,17 +33,14 @@ APP_UP = Gauge(
ACTIVE_INGESTORS = Gauge(
"ingestor_active_total",
"Number of active ingestors reported by Redis",
# No pod_id here, as it's a global view from Redis
)
SLOTS_TOTAL = Gauge(
"ingestor_slots_total",
"Total number of slots configured in Redis",
# No pod_id here, as it's a global view from Redis
)
LEASES_TOTAL = Gauge(
"ingestor_leases_total",
"Total number of leases (allocated slots) in Redis",
# No pod_id here, as it's a global view from Redis
)
SLOTS_MANAGED = Gauge(
"ingestor_slots_managed_current",
@@ -101,19 +94,6 @@ OPC_TAGS_SUBSCRIBED = Gauge(
"Current number of OPC tags subscribed on a server",
["pod_id", "server_name"],
)
OPC_DATACHANGE_NOTIFICATIONS = Counter(
"opc_datachange_notifications_total",
"Total data change notifications received (tag readings)",
TAG_LABELS,
)
OPC_TAG_LAST_VALUE = Gauge(
"opc_tag_last_value", "The last value read from an OPC tag", TAG_LABELS
)
OPC_TAG_LAST_READ_TIMESTAMP = Gauge(
"opc_tag_last_read_timestamp_seconds",
"Timestamp of the last value read from an OPC tag",
TAG_LABELS,
)
OPC_CYCLES_WITHOUT_DATA = Gauge(
"opc_cycles_without_data",
"Current number of cycles without receiving data from a server",