Fix Prometheus counters

default to gauage

Change-Id: Ia0428e61f023f10b02b3ebe103870d40c057abe3

Change values in question to gauges

Change-Id: I81c91c880246342a0ad0586f6dbe50b247a01117

fixes

Change-Id: I949438d3d3b511c22649640e082b59a3fb7696e0

Fix info handling

Change-Id: I8091fbfa55ba5a9c21c4569dd40e37fb432924f3

fix default

Change-Id: Ia449fed18730a06a858107e9218dc7b443a681fb
此提交包含在:
adapryor
2024-10-04 08:15:40 -05:00
提交者 Galantsev, Dmitrii
父節點 9571dad23d
當前提交 e847f74f78
共有 2 個檔案被更改,包括 81 行新增7 行删除
+39
查看文件
@@ -72,7 +72,14 @@ class rdc_field_type_t(c_int):
STRING = 2
BLOB = 3
class rdc_metric_type_t(c_int):
INVALID = 0
GAUGE = 1
COUNTER = 2
LABEL = 3
class rdc_field_t(c_int):
RDC_FI_INVALID = 0
RDC_FI_GPU_COUNT = 1
RDC_FI_DEV_NAME = 2
@@ -198,6 +205,38 @@ class rdc_field_t(c_int):
RDC_HEALTH_POWER_THROTTLE_TIME = 3006
RDC_HEALTH_THERMAL_THROTTLE_TIME = 3007
_rdc_metric_type_lookup = {
RDC_FI_INVALID: rdc_metric_type_t.INVALID,
RDC_FI_GPU_COUNT: rdc_metric_type_t.LABEL,
RDC_FI_DEV_NAME: rdc_metric_type_t.LABEL,
RDC_FI_OAM_ID: rdc_metric_type_t.LABEL,
RDC_FI_GPU_MEMORY_TOTAL: rdc_metric_type_t.COUNTER,
RDC_FI_ECC_CORRECT_TOTAL: rdc_metric_type_t.COUNTER,
RDC_FI_ECC_UNCORRECT_TOTAL: rdc_metric_type_t.COUNTER,
RDC_EVNT_NOTIF_VMFAULT: rdc_metric_type_t.COUNTER,
RDC_EVNT_NOTIF_THERMAL_THROTTLE: rdc_metric_type_t.COUNTER,
RDC_EVNT_NOTIF_PRE_RESET: rdc_metric_type_t.COUNTER,
RDC_EVNT_NOTIF_POST_RESET: rdc_metric_type_t.COUNTER,
RDC_EVNT_NOTIF_RING_HANG: rdc_metric_type_t.COUNTER,
}
@classmethod
def get_rdc_metric_type(cls, rdc_metric_t):
if isinstance(rdc_metric_t, str):
rdc_metric_t = getattr(cls, rdc_metric_t, None)
# If the metric was found, do the lookup, otherwise default GAUGE
if rdc_metric_t is not None:
return cls._rdc_metric_type_lookup.get(rdc_metric_t, rdc_metric_type_t.GAUGE)
return rdc_metric_type_t.GAUGE
@classmethod
def get_field_name(cls, value):
for attr_name, attr_value in cls.__dict__.items():
if isinstance(attr_value, int) and attr_value == value:
return attr_name
return "Unknown field value"
rdc_handle_t = c_void_p
rdc_gpu_group_t = c_uint32
rdc_field_grp_t = c_uint32