Giter VIP home page Giter VIP logo

collect's Introduction

Collect

Go Report Card codecov

Allows you to collect all pprof profiles with one command.

Installation

Just go-get it:

$ go get github.com/tommsawyer/collect/cmd/collect

Motivation

Sometimes 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

Usage

Provide url from which profiles will be scraped:

$ collect -u=http://localhost:8080

This 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:7070

You can choose which profiles will be scraped:

$ collect -p=allocs -p=heap -u=http://localhost:8080

Query parameters for profiles are also supported:

$ collect -p=trace\?seconds\=20 -u=http://localhost:8080

Use -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

Command-Line flags

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.

collect's People

Contributors

schoentoon avatar stepanovdmitrii avatar tommsawyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.