2 years ago
#45402
Strongman
Create Grafana Table Dashboard from Loki logs on Pytest results
I am quite a beginner with this, but I spent quite an amount of time already. I am trying to create a Table in Grafana from Pytest results from a Grafana Loki data source. There are multiple pytest tasks running at the same time. Thus, the table must show the progress of each task.
For example, the pytest logs look like this for task1
collecting ... collected 14 items
path1/to/pythonfile/testfile1.py::test_08 PASSED [ 71%]
path1/to/pythonfile/testfile1.py::test_09 PASSED [ 71%]
path2/to/pythonfile/testfile2.py::test_01 PASSED [ 64%]
The tale should be something like this:
Task ID | test | progress
------------------------------------------
task1 | test_08 | ************ 71%
------------------------------------------
task2 | test_22 | **** 22%
------------------------------------------
I think using the new feature "pattern" in Loki is the way to go, but I could not write a valid query. Now it has driven me to a point that I'd write a Python log processor on top Loki which I know is a bad idea. Could anyone help to continue to rely on Loki's LogQL? Thanks!
grafana
dashboard
grafana-loki
logql
0 Answers
Your Answer