pprofetheus

package module
v0.0.0-...-4252102 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

README

pprofetheus

GoDoc Go Report Card

pprofetheus is a collector for Prometheus that collects CPU profiling data for the current process and exports them as metrics. It can be used to monitor, visualize, and alert on profiling data from any Go process that imports pprofetheus and exports metrics via Prometheus.

Quick start

In order to use pprofetheus in your Prometheus-enabled Go application, you just need to

go get github.com/travelaudience/pprofetheus

and then import the same package, and set up the collector with Prometheus in your code, e.g. like this:

cpuProfileCollector, err := pprofetheus.NewCPUProfileCollector()
if err != nil {
	/* handle error */
}
prometheus.MustRegister(cpuProfileCollector)
cpuProfileCollector.Start()

After these changes, your application will export the Prometheus metrics pprof_cpu_time_used_ms, pprof_cpu_time_used_cum_ms, pprof_cpu_started and pprof_cpu_stopped.

pprof_cpu_time_used_ms contains the amount of milliseconds the program spent in the function provided in the label function.

pprof_cpu_time_used_cum_ms contains the cumulated amount of milliseconds the program spent in the function provided in the label function. This means that the amount of time spent in a function is accounted both for the function that spent the time and all functions up the call stack. The cumulated time thus includes the total time that a function spent, including all other functions that were called by that function.

pprof_cpu_started counts how often the Start method has been called on the collector, while pprof_cpu_stopped counts how often the Stop method has been called on the collector.

License

Please see the file LICENSE for licensing information.

The files in the subdirectory internal are subject to a separate license. See internal/LICENSE for licensing information.

Documentation

Overview

pprofetheus is a collector for Prometheus that collects CPU profiling data for the current process and exports them as metrics. It can be used to monitor, visualize, and alert on profiling data from any Go process that imports pprofetheus and exports metrics via Prometheus.

In order to use pprofetheus in your Prometheus-enabled Go application, you just need to

go get github.com/travelaudience/pprofetheus

and then import the same package, and set up the collector with Prometheus in your code, e.g. like this:

cpuProfileCollector, err := pprofetheus.NewCPUProfileCollector()
if err != nil {
	/* handle error */
}
prometheus.MustRegister(cpuProfileCollector)
cpuProfileCollector.Start()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfileCollector

type ProfileCollector interface {
	prometheus.Collector
	Start()
	Stop()
}

ProfileCollector describes a pprofetheus collector. It can act as a prometheus.Collector plus it can be Start()ed and Stop()ed to limit profiling to only desired time periods.

func NewCPUProfileCollector

func NewCPUProfileCollector() (ProfileCollector, error)

NewCPUProfileCollector creates a new CPU profile collector.

Directories

Path Synopsis
internal
bio
Package bio implements common I/O abstractions used within the Go toolchain.
Package bio implements common I/O abstractions used within the Go toolchain.
gcprog
Package gcprog implements an encoder for packed GC pointer bitmaps, known as GC programs.
Package gcprog implements an encoder for packed GC pointer bitmaps, known as GC programs.
goobj
Package goobj implements reading of Go object files and archives.
Package goobj implements reading of Go object files and archives.
obj
objfile
Package objfile implements portable access to OS-specific executable files.
Package objfile implements portable access to OS-specific executable files.
pprof/commands
Package commands defines and manages the basic pprof commands
Package commands defines and manages the basic pprof commands
pprof/driver
Package driver implements the core pprof functionality.
Package driver implements the core pprof functionality.
pprof/fetch
Package fetch provides an extensible mechanism to fetch a profile from a data source.
Package fetch provides an extensible mechanism to fetch a profile from a data source.
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/profile
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.
Package profile provides a representation of profile.proto and methods to encode/decode profiles in this format.
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/svg
Package svg provides tools related to handling of SVG files
Package svg provides tools related to handling of SVG files
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/tempfile
Package tempfile provides tools to create and delete temporary files
Package tempfile provides tools to create and delete temporary files
sys

Jump to

Keyboard shortcuts

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