[#248] add metrics methods

This commit is contained in:
Ilyas Niyazov 2024-06-21 10:41:28 +03:00 committed by Andrey Berezin
parent f1b2fbd47b
commit da16f3c3a5
2 changed files with 50 additions and 5 deletions

View file

@ -16,11 +16,6 @@ class StorageMetrics:
self.host = host
self.metrics_endpoint = metrics_endpoint
def get_metric_container(self, metric: str, cid: str) -> CommandResult:
shell = self.host.get_shell()
result = shell.exec(f"curl -s {self.metrics_endpoint} | grep {metric} |grep {cid}")
return result
def get_metrics_search_by_greps(self, **greps) -> CommandResult:
"""
Get a metrics, search by: cid, metric_type, shard_id etc.
@ -34,3 +29,8 @@ class StorageMetrics:
additional_greps = " |grep ".join([grep_command for grep_command in greps.values()])
result = shell.exec(f"curl -s {self.metrics_endpoint} | grep {additional_greps}")
return result
def get_all_metrics(self) -> CommandResult:
shell = self.host.get_shell()
result = shell.exec(f"curl -s {self.metrics_endpoint}")
return result