Skip to content

Commit c0cf16b

Browse files
[add] Added extract_exporter_metrics() method (#184)
1 parent 1c16cbb commit c0cf16b

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "redisbench-admin"
3-
version = "0.4.8"
3+
version = "0.4.9"
44
description = "Redis benchmark run helper. A wrapper around Redis and Redis Modules benchmark tools ( ftsb_redisearch, memtier_benchmark, redis-benchmark, aibench, etc... )."
55
authors = ["filipecosta90 <[email protected]>"]
66
readme = "README.md"

redisbench_admin/utils/benchmark_config.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,7 @@ def process_default_yaml_properties_file(
185185
default_config = yaml.safe_load(stream)
186186
default_specs = None
187187
cluster_config = None
188-
if "exporter" in default_config:
189-
default_metrics = parse_exporter_metrics_definition(default_config["exporter"])
190-
if len(default_metrics) > 0:
191-
logging.info(
192-
"Found RedisTimeSeries default metrics specification."
193-
" Will include the following metrics on all benchmarks {}".format(
194-
" ".join(default_metrics)
195-
)
196-
)
197-
exporter_timemetric_path = parse_exporter_timemetric_definition(
198-
default_config["exporter"]
199-
)
200-
if exporter_timemetric_path is not None:
201-
logging.info(
202-
"Found RedisTimeSeries default time metric specification."
203-
" Will use the following JSON path to retrieve the test time {}".format(
204-
exporter_timemetric_path
205-
)
206-
)
188+
default_metrics, exporter_timemetric_path = extract_exporter_metrics(default_config)
207189
if "kpis" in default_config:
208190
logging.info(
209191
"Loading default KPIs specifications from file: {}".format(
@@ -232,6 +214,29 @@ def process_default_yaml_properties_file(
232214
)
233215

234216

217+
def extract_exporter_metrics(default_config):
218+
if "exporter" in default_config:
219+
default_metrics = parse_exporter_metrics_definition(default_config["exporter"])
220+
if len(default_metrics) > 0:
221+
logging.info(
222+
"Found RedisTimeSeries default metrics specification."
223+
" Will include the following metrics on all benchmarks {}".format(
224+
" ".join(default_metrics)
225+
)
226+
)
227+
exporter_timemetric_path = parse_exporter_timemetric_definition(
228+
default_config["exporter"]
229+
)
230+
if exporter_timemetric_path is not None:
231+
logging.info(
232+
"Found RedisTimeSeries default time metric specification."
233+
" Will use the following JSON path to retrieve the test time {}".format(
234+
exporter_timemetric_path
235+
)
236+
)
237+
return default_metrics, exporter_timemetric_path
238+
239+
235240
def extract_benchmark_tool_settings(benchmark_config):
236241
benchmark_tool = None
237242
benchmark_tool_source = None

0 commit comments

Comments
 (0)