From deb2f12bec632585536d120e5917c04e6309726e Mon Sep 17 00:00:00 2001 From: Ilyas Niyazov Date: Tue, 21 May 2024 09:16:35 +0300 Subject: [PATCH] [#228] metrics for object --- src/frostfs_testlib/storage/dataclasses/metrics.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/frostfs_testlib/storage/dataclasses/metrics.py b/src/frostfs_testlib/storage/dataclasses/metrics.py index 49c59bc..c79dcf8 100644 --- a/src/frostfs_testlib/storage/dataclasses/metrics.py +++ b/src/frostfs_testlib/storage/dataclasses/metrics.py @@ -20,3 +20,17 @@ class StorageMetrics: 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. + Args: + greps: dict of grep-command-name and value + for example get_metrics_search_by_greps(command='container_objects_total', cid='123456') + Return: + result of metrics + """ + shell = self.host.get_shell() + 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