Skip to content

Commit 20a651b

Browse files
committed
mgr/dashboard: Added application label to pool_metadata query
fixes: https://tracker.ceph.com/issues/70843 Signed-off-by: Ankush Behl <[email protected]>
1 parent 9aacbd1 commit 20a651b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/pybind/mgr/prometheus/module.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from rbd import RBD
1818

1919
from typing import DefaultDict, Optional, Dict, Any, Set, cast, Tuple, Union, List, Callable, IO
20-
2120
LabelValues = Tuple[str, ...]
2221
Number = Union[int, float]
2322
MetricValue = Dict[LabelValues, Number]
@@ -94,7 +93,7 @@ def health_status_to_number(status: str) -> int:
9493

9594
OSD_STATS = ['apply_latency_ms', 'commit_latency_ms']
9695

97-
POOL_METADATA = ('pool_id', 'name', 'type', 'description', 'compression_mode')
96+
POOL_METADATA = ('pool_id', 'name', 'type', 'description', 'compression_mode', 'application')
9897

9998
RGW_METADATA = ('ceph_daemon', 'hostname', 'ceph_version', 'instance_id')
10099

@@ -127,6 +126,12 @@ class Format(enum.Enum):
127126
yaml = 'yaml'
128127

129128

129+
class StorageType(enum.Enum):
130+
rbd = "Block"
131+
cephfs = "Filesystem"
132+
rgw = "Object"
133+
134+
130135
class HealthCheckEvent:
131136

132137
def __init__(self, name: str, severity: Severity, first_seen: float, last_seen: float, count: int, active: bool = True):
@@ -1267,13 +1272,20 @@ def _get_pool_info(pool: Dict[str, Any]) -> Tuple[str, str]:
12671272
if 'options' in pool:
12681273
compression_mode = pool['options'].get('compression_mode', 'none')
12691274

1275+
application_metadata = pool.get('application_metadata', {})
1276+
application_metadata_str = ', '.join(StorageType[k].value
1277+
if k in StorageType.__members__ else str(k)
1278+
for k in application_metadata
1279+
)
12701280
self.metrics['pool_metadata'].set(
12711281
1, (
12721282
pool['pool'],
12731283
pool['pool_name'],
12741284
pool_type,
12751285
pool_description,
1276-
compression_mode)
1286+
compression_mode,
1287+
application_metadata_str,
1288+
),
12771289
)
12781290

12791291
# Populate other servers metadata

0 commit comments

Comments
 (0)