]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Added application label to pool_metadata query
authorAnkush Behl <cloudbehl@gmail.com>
Wed, 9 Apr 2025 06:33:36 +0000 (12:03 +0530)
committerAnkush Behl <cloudbehl@gmail.com>
Wed, 23 Apr 2025 11:21:19 +0000 (16:51 +0530)
fixes: https://tracker.ceph.com/issues/70843

Signed-off-by: Ankush Behl <cloudbehl@gmail.com>
src/pybind/mgr/prometheus/module.py

index 381f7e460c523fac271acaa2f30acf481a6f5781..273610f2ef7cd61f327c4ef14f0e2d54aa432f19 100644 (file)
@@ -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