From: Ankush Behl Date: Wed, 9 Apr 2025 06:33:36 +0000 (+0530) Subject: mgr/dashboard: Added application label to pool_metadata query X-Git-Tag: v20.1.0~283^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F63111%2Fhead;p=ceph.git mgr/dashboard: Added application label to pool_metadata query fixes: https://tracker.ceph.com/issues/70843 Signed-off-by: Ankush Behl (cherry picked from commit 20a651b8fd555c194c1a859c69505b2d47fda45b) --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 381f7e460c52..273610f2ef7c 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