arblang 0.1.24

Visualize and modify Unix pipelines: pipe a stream in, arb spawns a dynamic TUI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# celery — task events by state, runtimes, and slow-task tail
#   celery events --dump --json | arb -p celery
bars .states
source .states { in.json; field type; tally }
gauge .succeeded -max 1000
source .succeeded { in.json; match /task-succeeded/; count }
gauge .slow -max 500
source .slow { in.json; field runtime; where x > 5; count }
tail .failures
source .failures { in.json; match /task-failed/; field exception }

test "states tally" { given "{\"type\": \"task-succeeded\", \"runtime\": 2.0}" "{\"type\": \"task-succeeded\", \"runtime\": 8.0}" "{\"type\": \"task-failed\", \"exception\": \"ValueError\"}"; run { in.json; field type; tally }; want "task-succeeded\t2" "task-failed\t1" }
test "slow count" { given "{\"type\": \"task-succeeded\", \"runtime\": 2.0}" "{\"type\": \"task-succeeded\", \"runtime\": 8.0}" "{\"type\": \"task-succeeded\", \"runtime\": 12.0}"; run { in.json; field runtime; where x > 5; count }; want "2" }
test "failures" { given "{\"type\": \"task-failed\", \"exception\": \"ValueError\"}"; run { in.json; match /task-failed/; field exception }; want "ValueError" }