Allows you to collect all pprof profiles with one command.
Just go-get it:
$ go get github.com/tommsawyer/collect/cmd/collectSometimes I need to quickly collect all pprof profiles for future optimization. It's very frustrating to do it with long curl commands like:
$ curl -sK -v http://localhost:8080/debug/pprof/heap > heap.out && curl -sK -v http://localhost:8080/debug/pprof/allocs > allocs.out && curl -sK -v http://localhost:8080/debug/pprof/goroutine > goroutine.out && curl -sK -v http://localhost:8080/debug/pprof/profile > profile.out && curl -o ./trace "http://localhost:8080/debug/pprof/trace?debug=1&seconds=20"
Also:
- it doesn't run concurrently, resulting in slow execution
- you have to manually move profiles to some directories if you want to store them for future comparison
- you need to wait for the command to complete and run it again if you want to collect profiles several times
Provide url from which profiles will be scraped:
$ collect -u=http://localhost:8080This will download allocs, heap, goroutine and cpu profiles and save them into a directory structure like this:
- localhost 8080
- YYYY MM DD
- HH MM SS
- allocs
- heap
- profile
- goroutine
You can provide as many urls as you want:
$ collect -u=http://localhost:8080 -u=http://localhost:7070You can choose which profiles will be scraped:
$ collect -p=allocs -p=heap -u=http://localhost:8080Query parameters for profiles are also supported:
$ collect -p=trace\?seconds\=20 -u=http://localhost:8080Use -l flag to collect profiles in an endless loop(until Ctrl-C). This will collect profiles every 60 seconds (you can redefine interval with -i).
$ collect -l -u=http://localhost:8080| Flag | Default | Usage |
|---|---|---|
| -u | url from which profiles will be collected. | |
| -p | allocs,heap,goroutine,profile | profiles to collect. |
| -l | false | collect profiles in endless loop |
| -i | 60s | interval between collecting. use with -l |
| -d | ./ | directory to put the pprof files in. |
| -k | false | keep going collect if some requests failed. |