Skip to content

Commit ee763c7

Browse files
Merge pull request #12 from jtaleric/kube-burner-mem
Adding memory query and small refactor
2 parents 1d1d6c1 + 34ff117 commit ee763c7

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

.github/workflows/unit_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Run pytest on Pull Request
22

3-
on: [push,pull_request]
3+
on: [push]
44

55
jobs:
66
test:

fmatch/matcher.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ def burner_results(self, uuid, uuids, index):
195195
runs = [item['_source'] for item in result["hits"]["hits"]]
196196
return runs
197197

198-
def burner_cpu_results(self, uuids, namespace, index):
199-
""" kube burner CPU aggregated results for a namespace
198+
def burner_metric_query(self, uuids, namespace, index, metricName):
199+
""" burner_metric_query will query for specific metricName data.
200+
200201
Args:
201-
uuids (_type_): _description_
202-
namespace (_type_): _description_
203-
index (_type_): _description_
204-
Returns:
205-
_type_: _description_
202+
uuids (list): List of uuids
203+
namespace (str): namespace we are interested in
204+
index (str): ES/OS Index to query from
205+
metricName (str): metricName defined in kube-burner metrics
206206
"""
207207
ids = "\" OR uuid: \"".join(uuids)
208208
query = {
@@ -239,7 +239,7 @@ def burner_cpu_results(self, uuids, namespace, index):
239239
"query_string": {
240240
"query": (
241241
f'( uuid: \"{ids}\" )'
242-
f' AND metricName: "containerCPU"'
242+
f' AND metricName: {metricName}'
243243
f' AND labels.namespace.keyword: {namespace}'
244244
)
245245
}
@@ -252,6 +252,28 @@ def burner_cpu_results(self, uuids, namespace, index):
252252
data = self.parse_burner_cpu_results(runs)
253253
return data
254254

255+
def burner_cpu_results(self, uuids, namespace, index):
256+
""" kube burner CPU aggregated results for a namespace
257+
Args:
258+
uuids (_type_): _description_
259+
namespace (_type_): _description_
260+
index (_type_): _description_
261+
Returns:
262+
_type_: _description_
263+
"""
264+
return self.burner_metric_query(uuids, namespace, index, "containerCPU")
265+
266+
def burner_mem_results(self, uuids, namespace, index):
267+
""" kube burner memory aggregated results for a namespace
268+
Args:
269+
uuids (_type_): _description_
270+
namespace (_type_): _description_
271+
index (_type_): _description_
272+
Returns:
273+
_type_: _description_
274+
"""
275+
return self.burner_metric_query(uuids, namespace, index, "containerMemory")
276+
255277
def parse_burner_cpu_results(self, data: dict):
256278
""" parse out CPU data from kube-burner query
257279
Args:

fmatch/test_fmatch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
ids, "openshift-ovn-kubernetes", "ripsaw-kube-burner*")
3838
etcd_cpu = match.burner_cpu_results(
3939
ids, "openshift-etcd", "ripsaw-kube-burner*")
40+
ovn_mem = match.burner_mem_results(
41+
ids, "openshift-ovn-kubernetes", "ripsaw-kube-burner*")
4042

4143
podl_df = match.convert_to_df(
4244
podl, columns=['uuid', 'timestamp', 'quantileName', 'P99'])

0 commit comments

Comments
 (0)