Crate prometheus [] [src]

Modules

local
proto

Protocol buffers format of metrics.

Macros

histogram_opts

Create a HistogramOpts

labels

Create labes with specify name-value pairs.

opts

Create an Opts.

register_counter

Create a Counter and register to default registry.

register_counter_vec

Create a CounterVec and register to default registry.

register_gauge

Create a Gauge and register to default registry.

register_gauge_vec

Create a GaugeVec and register to default registry.

register_histogram

Create a Histogram and register to default registry.

register_histogram_vec

Create a HistogramVec and register to default registry.

Structs

Counter

Counter is a Metric that represents a single numerical value that only ever goes up.

Desc

Desc is the descriptor used by every Prometheus Metric. It is essentially the immutable meta-data of a Metric. The normal Metric implementations included in this package manage their Desc under the hood.

Gauge

Gauge is a Metric that represents a single numerical value that can arbitrarily go up and down.

Histogram

A Histogram counts individual observations from an event or sample stream in configurable buckets. Similar to a summary, it also provides a sum of observations and an observation count.

HistogramOpts

HistogramOpts bundles the options for creating a Histogram metric. It is mandatory to set Name and Help to a non-empty string. All other fields are optional and can safely be left at their zero value.

HistogramTimer

HistogramTimer represents an event being timed. When the timer goes out of scope, the duration will be observed, or call observe_duration to manually observe.

Opts

Opts bundles the options for creating most Metric types.

ProtobufEncoder

Implementation of an Encoder that converts a MetricFamily proto message into the binary wire format of protobuf.

Registry

Registry registers Prometheus collectors, collects their metrics, and gathers them into MetricFamilies for exposition.

TextEncoder

Implementation of an Encoder that converts a MetricFamily proto message into text format.

Enums

Error

The error types for prometheus.

Constants

DEFAULT_BUCKETS

DEFAULT_BUCKETS are the default Histogram buckets. The default buckets are tailored to broadly measure the response time (in seconds) of a network service. Most likely, however, you will be required to define buckets customized to your use case.

PROTOBUF_FORMAT

The protocol buffer format of metric family.

TEXT_FORMAT

The text format of metric family.

Traits

Collector

Collector is the trait that can be used to collect metrics. A Collector has to be registered for collection.

Encoder

Encoder types encode metric families into an underlying wire protocol.

Functions

exponential_buckets

exponential_buckets creates count buckets, where the lowest bucket has an upper bound of start and each following buckets upper bound isfactortimes the previous buckets upper bound. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field of HistogramOpts.

gather

gather returns all MetricFamily of DEFAULT_REGISTRY.

linear_buckets

linear_buckets creates count buckets, each width wide, where the lowest bucket has an upper bound of start. The final +Inf bucket is not counted and not included in the returned slice. The returned slice is meant to be used for the Buckets field of HistogramOpts.

register

register registers a new Collector to be included in metrics collection. It returns an error if the descriptors provided by the Collector are invalid or if they - in combination with descriptors of already registered Collectors - do not fulfill the consistency and uniqueness criteria described in the Desc documentation.

unregister

unregister unregisters the Collector that equals the Collector passed in as an argument. (Two Collectors are considered equal if their Describe method yields the same set of descriptors.) The function returns an error if a Collector was not registered.

Type Definitions

CounterVec

CounterVec is a Collector that bundles a set of Counters that all share the same Desc, but have different values for their variable labels. This is used if you want to count the same thing partitioned by various dimensions (e.g. number of HTTP requests, partitioned by response code and method).

GaugeVec

GaugeVec is a Collector that bundles a set of Gauges that all share the same Desc, but have different values for their variable labels. This is used if you want to count the same thing partitioned by various dimensions (e.g. number of operations queued, partitioned by user and operation type).

HistogramVec

HistogramVec is a Collector that bundles a set of Histograms that all share the same Desc, but have different values for their variable labels. This is used if you want to count the same thing partitioned by various dimensions (e.g. HTTP request latencies, partitioned by status code and method).

Result

A specialized Result type for prometheus.