conprof

command module
v0.0.0-...-42b049c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 56 Imported by: 0

README

conprof - Continuous Profiling

Docker Repository on Quay Discord chat

Conprof is a continuous profiling project. Continuous profiling is the act of taking profiles of programs in a systematic way. Conprof collects, stores and makes profiles available to be queried over time.

Conprof features:

  • A multi-dimensional data model (series of profiles are identified by their type and set of key/value dimensions)
  • A query language to explore profiles over time
  • No dependency on distributed storage; single server nodes are autonomous
  • A HTTP pull model, that scrapes profiles from processes and stores it in its database
  • Targets are discovered via service discovery or static configuration
Why?

Have you ever been in the situation where you know your application has a memory leak and was OOMKilled, but you of course don't have the memory profile from right before that happened? Or you experienced a latency spike in your application and you wish you had a CPU profile from exactly that point in time, but don't have it? This is why continuous profiling is important, it allows answering these questions even in retrospect, without going on a search for the needle in the haystack after the fact.

Conprof is most useful when paired with a metrics system such as Prometheus, as Prometheus can be used to identify a situation based on metrics and Conprof can be used to investigate the particular situation.

Getting started

To continuously profile an application with Conprof, it must expose HTTP endpoints that when requested, return pprof compatible profiles. Instrumenting your application is a one time thing, and only takes a few lines of code, find out how to instrument your application.

For demonstration purposes this guide uses the pprof-example-app-go project, using the pre-built container image available:

docker run --network host --rm -it quay.io/polarsignals/pprof-example-app-go:v0.1.0

This app calculates large fibonacci numbers, so a bunch of numbers will be printed on the terminal.

Next we start Conprof using docker and scrape profiles from the pprof-example-app-go.

Here we're using the master-2021-02-15-56c07ca tag, but choose the version you want to use from the container image repo:

docker run --network host --rm -it -v /etc/passwd:/etc/passwd -u `id -u`:`id -g` -v `pwd`:`pwd`:z -w `pwd` quay.io/conprof/conprof:master-2021-02-15-56c07ca all --config.file examples/pprof-example-app-go.yaml --http-address :10902 --storage.tsdb.path ./data

Open http://localhost:10902/ and write a query like heap{job="pprof-example-app-go"} which displays results on a timeline.

Here's a screenshot of what that might look like after a few minutes of running.

conprof screenshot

When clicking on a sample the pprof UI included in the pprof toolchain, will be opened. An example could be:

pprof UI screenshot

Build

You can also build the conprof binary yourself from the root of the repo directory:

git clone git@github.com:conprof/conprof.git
GO111MODULE=on GOPROXY=https://proxy.golang.org go install -v

Running the getting started example with the binary you built:

conprof all --config.file examples/conprof.yaml --http-address :10902 --storage.tsdb.path ./data
Building the UI
  • Run npm install and npm run build once in the web directory.
  • Run make assets to inline the assets into a go file.
  • Run make conprof to build the app.

Note: For UI development you can run npm start in the web directory and it will proxy requests to the backend.

Contributing

Refer to CONTRIBUTING.md.

License

Apache License 2.0, see LICENSE.

Inspiration

If this sounds a lot like Prometheus, then that's no accident. The initial creator of Conprof ( @brancz ) is also a Prometheus maintainer. Conprof is based on a lot of principles and even code of Prometheus, the service discovery mechanism and configuration works very similar to Prometheus and the general functionality is similar, as consecutive profiles of the same type and the same process behave similar to time-series, as in that they are related events of the same origin thus they are in the same series. Only that sample values in Conprof are not float64, but an arbitrary byte array.

Additionally, Google has written about continuous profiling in their whitepaper: Google-Wide Profiling: A Continuous Profiling Infrastructure for Data Centers".

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
pprof/binutils
Package binutils provides access to the GNU binutils.
Package binutils provides access to the GNU binutils.
pprof/driver
Package driver implements the core pprof functionality.
Package driver implements the core pprof functionality.
pprof/elfexec
Package elfexec provides utility routines to examine ELF binaries.
Package elfexec provides utility routines to examine ELF binaries.
pprof/elfexec/testelf
Package testelf provides elf.File objects for testing.
Package testelf provides elf.File objects for testing.
pprof/graph
Package graph collects a set of samples into a directed graph.
Package graph collects a set of samples into a directed graph.
pprof/measurement
Package measurement export utility functions to manipulate/format performance profile sample values.
Package measurement export utility functions to manipulate/format performance profile sample values.
pprof/plugin
Package plugin defines the plugin implementations that the main pprof driver requires.
Package plugin defines the plugin implementations that the main pprof driver requires.
pprof/proftest
Package proftest provides some utility routines to test other packages related to profiles.
Package proftest provides some utility routines to test other packages related to profiles.
pprof/report
Package report summarizes a performance profile into a human-readable report.
Package report summarizes a performance profile into a human-readable report.
pprof/symbolizer
Package symbolizer provides a routine to populate a profile with symbol, file and line number information.
Package symbolizer provides a routine to populate a profile with symbol, file and line number information.
pprof/symbolz
Package symbolz symbolizes a profile using the output from the symbolz service.
Package symbolz symbolizes a profile using the output from the symbolz service.
pprof/transport
Package transport provides a mechanism to send requests with https cert, key, and CA.
Package transport provides a mechanism to send requests with https cert, key, and CA.
pkg
runutil
Package runutil provides helpers to advanced function scheduling control like repeat or retry.
Package runutil provides helpers to advanced function scheduling control like repeat or retry.
test
web
Package ui provides the assets via a virtual filesystem.
Package ui provides the assets via a virtual filesystem.
modtimevfs
Package modtimevfs implements a virtual file system that returns a fixed modification time for all files and directories.
Package modtimevfs implements a virtual file system that returns a fixed modification time for all files and directories.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL