docker: github.com/docker/docker/vendor/github.com/docker/go-metrics Index | Files

package metrics

import "github.com/docker/docker/vendor/github.com/docker/go-metrics"

Index

Package Files

counter.go docs.go gauge.go handler.go helpers.go namespace.go register.go timer.go unit.go

Constants

const (
    InstrumentHandlerResponseSize = iota
    InstrumentHandlerRequestSize
    InstrumentHandlerDuration
    InstrumentHandlerCounter
    InstrumentHandlerInFlight
)

func Deregister Uses

func Deregister(n *Namespace)

Deregister removes all the metrics in the provided namespace from the global metrics registry

func Handler Uses

func Handler() http.Handler

Handler returns the global http.Handler that provides the prometheus metrics format on GET requests. This handler is no longer instrumented.

func InstrumentHandler Uses

func InstrumentHandler(metrics []*HTTPMetric, handler http.Handler) http.HandlerFunc

func InstrumentHandlerFunc Uses

func InstrumentHandlerFunc(metrics []*HTTPMetric, handlerFunc http.HandlerFunc) http.HandlerFunc

func Register Uses

func Register(n *Namespace)

Register adds all the metrics in the provided namespace to the global metrics registry

func StartTimer Uses

func StartTimer(timer Timer) (done func())

StartTimer begins a timer observation at the callsite. When the target operation is completed, the caller should call the return done func().

type Counter Uses

type Counter interface {
    // Inc adds Sum(vs) to the counter. Sum(vs) must be positive.
    //
    // If len(vs) == 0, increments the counter by 1.
    Inc(vs ...float64)
}

Counter is a metrics that can only increment its current count

type Gauge Uses

type Gauge interface {
    Inc(...float64)
    Dec(...float64)

    // Add adds the provided value to the gauge's current value
    Add(float64)

    // Set replaces the gauge's current value with the provided value
    Set(float64)
}

Gauge is a metric that allows incrementing and decrementing a value

type HTTPHandlerOpts Uses

type HTTPHandlerOpts struct {
    DurationBuckets     []float64
    RequestSizeBuckets  []float64
    ResponseSizeBuckets []float64
}

HTTPHandlerOpts describes a set of configurable options of http metrics

type HTTPMetric Uses

type HTTPMetric struct {
    prometheus.Collector
    // contains filtered or unexported fields
}

type LabeledCounter Uses

type LabeledCounter interface {
    WithValues(vs ...string) Counter
}

LabeledCounter is counter that must have labels populated before use.

type LabeledGauge Uses

type LabeledGauge interface {
    WithValues(labels ...string) Gauge
}

LabeledGauge describes a gauge the must have values populated before use.

type LabeledTimer Uses

type LabeledTimer interface {
    WithValues(labels ...string) *labeledTimerObserver
}

LabeledTimer is a timer that must have label values populated before use.

type Labels Uses

type Labels map[string]string

type Namespace Uses

type Namespace struct {
    // contains filtered or unexported fields
}

Namespace describes a set of metrics that share a namespace and subsystem.

func NewNamespace Uses

func NewNamespace(name, subsystem string, labels Labels) *Namespace

NewNamespace returns a namespaces that is responsible for managing a collection of metrics for a particual namespace and subsystem

labels allows const labels to be added to all metrics created in this namespace and are commonly used for data like application version and git commit

func (*Namespace) Add Uses

func (n *Namespace) Add(collector prometheus.Collector)

func (*Namespace) Collect Uses

func (n *Namespace) Collect(ch chan<- prometheus.Metric)

func (*Namespace) Describe Uses

func (n *Namespace) Describe(ch chan<- *prometheus.Desc)

func (*Namespace) NewCounter Uses

func (n *Namespace) NewCounter(name, help string) Counter

func (*Namespace) NewDefaultHttpMetrics Uses

func (n *Namespace) NewDefaultHttpMetrics(handlerName string) []*HTTPMetric

func (*Namespace) NewDesc Uses

func (n *Namespace) NewDesc(name, help string, unit Unit, labels ...string) *prometheus.Desc

func (*Namespace) NewGauge Uses

func (n *Namespace) NewGauge(name, help string, unit Unit) Gauge

func (*Namespace) NewHttpMetrics Uses

func (n *Namespace) NewHttpMetrics(handlerName string, durationBuckets, requestSizeBuckets, responseSizeBuckets []float64) []*HTTPMetric

func (*Namespace) NewHttpMetricsWithOpts Uses

func (n *Namespace) NewHttpMetricsWithOpts(handlerName string, opts HTTPHandlerOpts) []*HTTPMetric

func (*Namespace) NewInFlightGaugeMetric Uses

func (n *Namespace) NewInFlightGaugeMetric(handlerName string) *HTTPMetric

func (*Namespace) NewLabeledCounter Uses

func (n *Namespace) NewLabeledCounter(name, help string, labels ...string) LabeledCounter

func (*Namespace) NewLabeledGauge Uses

func (n *Namespace) NewLabeledGauge(name, help string, unit Unit, labels ...string) LabeledGauge

func (*Namespace) NewLabeledTimer Uses

func (n *Namespace) NewLabeledTimer(name, help string, labels ...string) LabeledTimer

func (*Namespace) NewRequestDurationMetric Uses

func (n *Namespace) NewRequestDurationMetric(handlerName string, buckets []float64) *HTTPMetric

func (*Namespace) NewRequestSizeMetric Uses

func (n *Namespace) NewRequestSizeMetric(handlerName string, buckets []float64) *HTTPMetric

func (*Namespace) NewRequestTotalMetric Uses

func (n *Namespace) NewRequestTotalMetric(handlerName string) *HTTPMetric

func (*Namespace) NewResponseSizeMetric Uses

func (n *Namespace) NewResponseSizeMetric(handlerName string, buckets []float64) *HTTPMetric

func (*Namespace) NewTimer Uses

func (n *Namespace) NewTimer(name, help string) Timer

func (*Namespace) WithConstLabels Uses

func (n *Namespace) WithConstLabels(labels Labels) *Namespace

WithConstLabels returns a namespace with the provided set of labels merged with the existing constant labels on the namespace.

Only metrics created with the returned namespace will get the new constant
labels.  The returned namespace must be registered separately.

type Timer Uses

type Timer interface {
    // Update records an observation, duration, and converts to the target
    // units.
    Update(duration time.Duration)

    // UpdateSince will add the duration from the provided starting time to the
    // timer's summary with the precisions that was used in creation of the timer
    UpdateSince(time.Time)
}

Timer is a metric that allows collecting the duration of an action in seconds

type Unit Uses

type Unit string

Unit represents the type or precision of a metric that is appended to the metrics fully qualified name

const (
    Nanoseconds Unit = "nanoseconds"
    Seconds     Unit = "seconds"
    Bytes       Unit = "bytes"
    Total       Unit = "total"
)

Package metrics imports 6 packages (graph). Updated 2020-02-07. Refresh now. Tools for package owners.