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

@@ -165,50 +165,6 @@ def test_opc_tags_subscribed():
assert set(metrics.OPC_TAGS_SUBSCRIBED._labelnames) == {"pod_id", "server_name"}
def test_opc_datachange_notifications():
"""Verify the definition of OPC_DATACHANGE_NOTIFICATIONS."""
assert metrics.OPC_DATACHANGE_NOTIFICATIONS is not None
assert isinstance(metrics.OPC_DATACHANGE_NOTIFICATIONS, Counter)
assert (
metrics.OPC_DATACHANGE_NOTIFICATIONS._name == "opc_datachange_notifications"
) # REMOVED _total
assert set(metrics.OPC_DATACHANGE_NOTIFICATIONS._labelnames) == {
"pod_id",
"server_name",
"tag_id",
"tag_name",
}
def test_opc_tag_last_value():
"""Verify the definition of OPC_TAG_LAST_VALUE."""
assert metrics.OPC_TAG_LAST_VALUE is not None
assert isinstance(metrics.OPC_TAG_LAST_VALUE, Gauge)
assert metrics.OPC_TAG_LAST_VALUE._name == "opc_tag_last_value"
assert set(metrics.OPC_TAG_LAST_VALUE._labelnames) == {
"pod_id",
"server_name",
"tag_id",
"tag_name",
}
def test_opc_tag_last_read_timestamp():
"""Verify the definition of OPC_TAG_LAST_READ_TIMESTAMP."""
assert metrics.OPC_TAG_LAST_READ_TIMESTAMP is not None
assert isinstance(metrics.OPC_TAG_LAST_READ_TIMESTAMP, Gauge)
assert (
metrics.OPC_TAG_LAST_READ_TIMESTAMP._name
== "opc_tag_last_read_timestamp_seconds"
)
assert set(metrics.OPC_TAG_LAST_READ_TIMESTAMP._labelnames) == {
"pod_id",
"server_name",
"tag_id",
"tag_name",
}
def test_opc_cycles_without_data():
"""Verify the definition of OPC_CYCLES_WITHOUT_DATA."""
assert metrics.OPC_CYCLES_WITHOUT_DATA is not None