Page MenuHomePhabricator
Paste P8379

analyze-thread-dumps.sh
ActivePublic

Authored by dduvall on Apr 9 2019, 9:47 PM.
#!/bin/sh
tmpdir="$(mktemp -d)"
if [[ $# -lt 1 ]]; then
echo "Usage: $(basename "$0") dumpfile ..."
exit 1
fi
if [[ "x$FT_API_KEY" == "x" ]]; then
echo "Please set the FT_API_KEY environment variable to your fastthread.io API key"
exit 2
fi
mkdir -p "$tmpdir"/dumps
for f in "$@"; do
(
echo Full thread dump Java
tail -n +4 "$f"
) > $tmpdir/dumps/"$(basename "$f")"
done
cd "$tmpdir"
tar czf dumps.tar.gz dumps/
curl -s -X POST \
--header "Content-Type: application/tar" \
--header "Content-Encoding: application/gzip" \
--data-binary @"$tmpdir"/dumps.tar.gz \
"https://api.fastthread.io/fastthread-api?apiKey=$FT_API_KEY"
rm "$tmpdir"/dumps/*
rmdir "$tmpdir"/dumps
rm "$tmpdir"/dumps.tar.gz
rmdir "$tmpdir"

Event Timeline

dduvall edited the content of this paste. (Show Details)Apr 9 2019, 9:47 PM
dduvall changed the title of this paste from untitled to analyze-thread-dumps.sh.
dduvall updated the paste's language from autodetect to sh.