From 20a651b8fd555c194c1a859c69505b2d47fda45b Mon Sep 17 00:00:00 2001 From: Ankush Behl Date: Wed, 9 Apr 2025 12:03:36 +0530 Subject: [PATCH] mgr/dashboard: Added application label to pool_metadata query fixes: https://tracker.ceph.com/issues/70843 Signed-off-by: Ankush Behl --- src/pybind/mgr/prometheus/module.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 381f7e460c5..273610f2ef7 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -17,7 +17,6 @@ from orchestrator import OrchestratorClientMixin, raise_if_exception, Orchestrat from rbd import RBD from typing import DefaultDict, Optional, Dict, Any, Set, cast, Tuple, Union, List, Callable, IO - LabelValues = Tuple[str, ...] Number = Union[int, float] MetricValue = Dict[LabelValues, Number] @@ -94,7 +93,7 @@ OSD_STATUS = ['weight', 'up', 'in'] OSD_STATS = ['apply_latency_ms', 'commit_latency_ms'] -POOL_METADATA = ('pool_id', 'name', 'type', 'description', 'compression_mode') +POOL_METADATA = ('pool_id', 'name', 'type', 'description', 'compression_mode', 'application') RGW_METADATA = ('ceph_daemon', 'hostname', 'ceph_version', 'instance_id') @@ -127,6 +126,12 @@ class Format(enum.Enum): yaml = 'yaml' +class StorageType(enum.Enum): + rbd = "Block" + cephfs = "Filesystem" + rgw = "Object" + + class HealthCheckEvent: def __init__(self, name: str, severity: Severity, first_seen: float, last_seen: float, count: int, active: bool = True): @@ -1267,13 +1272,20 @@ class Module(MgrModule, OrchestratorClientMixin): if 'options' in pool: compression_mode = pool['options'].get('compression_mode', 'none') + application_metadata = pool.get('application_metadata', {}) + application_metadata_str = ', '.join(StorageType[k].value + if k in StorageType.__members__ else str(k) + for k in application_metadata + ) self.metrics['pool_metadata'].set( 1, ( pool['pool'], pool['pool_name'], pool_type, pool_description, - compression_mode) + compression_mode, + application_metadata_str, + ), ) # Populate other servers metadata -- 2.39.5