Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CAD-1073 scripts | analyses: simplify automation
  • Loading branch information
deepfire committed Jul 2, 2020
1 parent c375ef6 commit 0558c51
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 0 deletions.
18 changes: 18 additions & 0 deletions analyses/explorer.MsgBlock.sh
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

grep --no-filename -F 'MsgBlock' "$@" |
jq 'def katip_timestamp_to_iso8601:
.[:-4] + "Z";
.
| map
( (.at | katip_timestamp_to_iso8601)
as $date_iso
| { date_iso: $date_iso
, timestamp: $date_iso | fromdateiso8601
, blkid: .data.msg.blkid
, txs: (.data.msg.txids | length)
}
)
| sort_by (.timestamp)
| .[]
' --slurp --compact-output
10 changes: 10 additions & 0 deletions analyses/node.AddedBlockToQueue.sh
@@ -0,0 +1,10 @@
#!/bin/sh

grep -Fh '"TraceAddBlockEvent.AddedBlockToQueue"' "$@" |
jq '.
| { timestamp: .at
, host: .host
, slot: .data.block.slot
, kind: .data.kind
}
' --compact-output
10 changes: 10 additions & 0 deletions analyses/node.AddedToCurrentChain.sh
@@ -0,0 +1,10 @@
#!/bin/sh

grep -Fh '"TraceAddBlockEvent.AddedToCurrentChain"' "$@" |
jq '.
| { timestamp: .at
, host: .host
, slot: .data.headers[0].slotNo
, kind: .data.kind
}
' --compact-output
18 changes: 18 additions & 0 deletions analyses/node.TraceMempoolRejectedTx.sh
@@ -0,0 +1,18 @@
#!/bin/sh

grep -Fh '"TraceMempoolRejectedTx"' "$@" |
jq 'def katip_timestamp_to_iso8601:
.[:-4] + "Z";
.
| map
( (.at | katip_timestamp_to_iso8601)
as $date_iso
| { date_iso: $date_iso
, timestamp: ($date_iso | fromdateiso8601)
, host: .host
, txid: .data.tx.txid[5:]
, err: .data.err
})
| sort_by (.timestamp)
| .[]
' --slurp --compact-output
6 changes: 6 additions & 0 deletions analyses/tocsv.AddedBlockToQueue.sh
@@ -0,0 +1,6 @@
#!/bin/sh

jq '[ .timestamp, .kind, .slot | tostring ]
| @csv
' --raw-output "$@" |
sed -e 's/\([0-9-]\+\)T\([0-9:.]\+\)Z/\1 \2/; s_"__g'
6 changes: 6 additions & 0 deletions analyses/tocsv.AddedToCurrentChain.sh
@@ -0,0 +1,6 @@
#!/bin/sh

jq '[ .timestamp, .kind, .slot | tostring ]
| @csv
' --raw-output "$@" |
sed -e 's/\([0-9-]\+\)T\([0-9:.]\+\)Z/\1 \2/; s_"__g'
13 changes: 13 additions & 0 deletions analyses/tocsv.TraceMempoolRejectedTx.sh
@@ -0,0 +1,13 @@
#!/bin/sh

jq 'def nodename_to_index:
.[5:];
[ .date_iso
, (.host | nodename_to_index)
, .txid
, .err
]
| join(",")
' --raw-output "$@" |
sed -e 's/\([0-9-]\+\)T\([0-9:.]\+\)Z/\1 \2/; s_"__g'

0 comments on commit 0558c51

Please sign in to comment.