Documentation ¶
Overview ¶
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0
Index ¶
- func ProvideCounter(o prometheus.CounterOpts, labelNames ...string) fx.Annotated
- func ProvideCounterVec(o prometheus.CounterOpts, labelNames ...string) fx.Annotated
- func ProvideGauge(o prometheus.GaugeOpts, labelNames ...string) fx.Annotated
- func ProvideGaugeVec(o prometheus.GaugeOpts, labelNames ...string) fx.Annotated
- func ProvideHistogram(o prometheus.HistogramOpts, labelNames ...string) fx.Annotated
- func ProvideHistogramVec(o prometheus.HistogramOpts, labelNames ...string) fx.Annotated
- func ProvideSummary(o prometheus.SummaryOpts, labelNames ...string) fx.Annotated
- func ProvideSummaryVec(o prometheus.SummaryOpts, labelNames ...string) fx.Annotated
- func Unmarshal(configKey string) func(MetricsIn) (MetricsOut, error)
- type Adder
- type Factory
- type GaugeAdder
- type LabelledCounter
- type LabelledCounterVec
- type LabelledGauge
- type LabelledGaugeVec
- type LabelledHistogram
- type LabelledObserverVec
- type Labels
- type MetricsIn
- type MetricsOut
- type Observer
- type Options
- type Registry
- type Setter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvideCounter ¶
func ProvideCounter(o prometheus.CounterOpts, labelNames ...string) fx.Annotated
ProvideCounter emits an uber/fx component of type metrics.Counter using the unqualified name specified in the options struct.
func ProvideCounterVec ¶
func ProvideCounterVec(o prometheus.CounterOpts, labelNames ...string) fx.Annotated
ProvideCounterVec emits an uber/fx component of the *prometheus.CounterVec using the unqualified name specified in the options struct. Use this provider when lower-level access to prometheus features is needed.
func ProvideGauge ¶
func ProvideGauge(o prometheus.GaugeOpts, labelNames ...string) fx.Annotated
ProvideGauge emits an uber/fx component of type metrics.Gauge using the unqualified name specified in the options struct.
func ProvideGaugeVec ¶
func ProvideGaugeVec(o prometheus.GaugeOpts, labelNames ...string) fx.Annotated
ProvideGaugeVec emits an uber/fx component of the *prometheus.GaugeVec using the unqualified name specified in the options struct. Use this provider when lower-level access to prometheus features is needed.
func ProvideHistogram ¶
func ProvideHistogram(o prometheus.HistogramOpts, labelNames ...string) fx.Annotated
ProvideHistogram emits an uber/fx component of type metrics.Histogram using the unqualified name specified in the options struct.
func ProvideHistogramVec ¶
func ProvideHistogramVec(o prometheus.HistogramOpts, labelNames ...string) fx.Annotated
ProvideHistogramVec emits an uber/fx component of the *prometheus.HistogramVec using the unqualified name specified in the options struct. Use this provider when lower-level access to prometheus features is needed.
func ProvideSummary ¶
func ProvideSummary(o prometheus.SummaryOpts, labelNames ...string) fx.Annotated
ProvideHistogram emits an uber/fx component of type metrics.Histogram using the unqualified name specified in the options struct. Note that go-kit does not have a separate summary metric type.
func ProvideSummaryVec ¶
func ProvideSummaryVec(o prometheus.SummaryOpts, labelNames ...string) fx.Annotated
ProvideSummaryVec emits an uber/fx component of the *prometheus.SummaryVec using the unqualified name specified in the options struct. Use this provider when lower-level access to prometheus features is needed.
func Unmarshal ¶
func Unmarshal(configKey string) func(MetricsIn) (MetricsOut, error)
Unmarshal produces an uber/fx provider that bootstraps a prometheus-based metrics environment. No HTTP initialization is done by this package. To obtain a prometheus handler, use xmetricshttp.Unmarshal, which invokes this method in addition to the HTTP initialization.
Types ¶
type Adder ¶
type Adder interface { // Add increments the underlying metric, applying Labels if non-nil and non-empty. // Note that this method should only be used with positive values. Add(*Labels, float64) }
Adder is a strategy for adding a delta to a metric, with optional labels applied
type Factory ¶
type Factory interface { // NewCounter constructs a go-kit Counter backed by a prometheus counter. The wrapped counter // will be registered if this implementation is also a Registerer (the default). NewCounter(prometheus.CounterOpts, []string) (metrics.Counter, error) // NewCounterVec constructs a prometheus counter. This counter will be registered if this implementation // is also a Registerer (the default). // // Use this method when lower level access to prometheus features are required, such as currying. NewCounterVec(prometheus.CounterOpts, []string) (*prometheus.CounterVec, error) // NewGauge constructs a go-kit Gauge backed by a prometheus gauge. The wrapped gauge // will be registered if this implementation is also a Registerer (the default). NewGauge(prometheus.GaugeOpts, []string) (metrics.Gauge, error) // NewGaugeVec constructs a prometheus gauge. This gauge will be registered if this implementation // is also a Registerer (the default). // // Use this method when lower level access to prometheus features are required, such as currying. NewGaugeVec(prometheus.GaugeOpts, []string) (*prometheus.GaugeVec, error) // NewHistogram constructs a go-kit Histogram backed by a prometheus histogram. The wrapped histogram // will be registered if this implementation is also a Registerer (the default). NewHistogram(prometheus.HistogramOpts, []string) (metrics.Histogram, error) // NewHistogramVec constructs a prometheus histogram. This histogram will be registered if this implementation // is also a Registerer (the default). // // Use this method when lower level access to prometheus features are required, such as currying. NewHistogramVec(prometheus.HistogramOpts, []string) (*prometheus.HistogramVec, error) // NewSummary constructs a go-kit Histogram backed by a prometheus summary. The wrapped summary // will be registered if this implementation is also a Registerer (the default). // // Go-kit does not have a separate histogram vs summary interface. Thus, client code wishing to stay // abstracted from prometheus needs to use go-kit's Histogram interface. NewSummary(prometheus.SummaryOpts, []string) (metrics.Histogram, error) // NewSummaryVec constructs a prometheus summary. This summary will be registered if this implementation // is also a Registerer (the default). // // Use this method when lower level access to prometheus features are required, such as currying. NewSummaryVec(prometheus.SummaryOpts, []string) (*prometheus.SummaryVec, error) }
Factory is a creational strategy go-kit and prometheus metrics
type GaugeAdder ¶
type GaugeAdder interface { // GaugeAdd adds a delta to the underlying metric, applying Labels if non-nil and non-empty. // This method can be used with any value, not just positive values. GaugeAdd(*Labels, float64) }
GaugeAdder is like Adder, but specific to gauges. Client code can consume this interface to prevent counters from being used where a gauge is specifically needed. With most metrics backends, counters can only have positive values added while gauges allow adding any value. Use of this interface allows the compiler to prevent misconfiguration.
type LabelledCounter ¶
LabelledCounter is an Adder which uses a go-kit Counter
func (LabelledCounter) Add ¶
func (lc LabelledCounter) Add(l *Labels, v float64)
type LabelledCounterVec ¶
type LabelledCounterVec struct {
*prometheus.CounterVec
}
LabelledCounterVec is an Adder which uses a prometheus CounterVec
func (LabelledCounterVec) Add ¶
func (lcv LabelledCounterVec) Add(l *Labels, v float64)
type LabelledGauge ¶
LabelledGauge provides Adder, Setter, and GaugeAdder support for a go-kit Gauge
func (LabelledGauge) Add ¶
func (lg LabelledGauge) Add(l *Labels, v float64)
func (LabelledGauge) GaugeAdd ¶
func (lg LabelledGauge) GaugeAdd(l *Labels, v float64)
func (LabelledGauge) Set ¶
func (lg LabelledGauge) Set(l *Labels, v float64)
type LabelledGaugeVec ¶
type LabelledGaugeVec struct {
*prometheus.GaugeVec
}
LabelledGaugeVec provides Adder, Setter, and GaugeAdder support for a prometheus GaugeVec
func (LabelledGaugeVec) Add ¶
func (lgv LabelledGaugeVec) Add(l *Labels, v float64)
func (LabelledGaugeVec) GaugeAdd ¶
func (lgv LabelledGaugeVec) GaugeAdd(l *Labels, v float64)
func (LabelledGaugeVec) Set ¶
func (lgv LabelledGaugeVec) Set(l *Labels, v float64)
type LabelledHistogram ¶
LabelledHistogram is an Observer backed by a go-kit Histogram
func (LabelledHistogram) Observe ¶
func (lh LabelledHistogram) Observe(l *Labels, v float64)
type LabelledObserverVec ¶
type LabelledObserverVec struct {
prometheus.ObserverVec
}
LabelledObserverVec is an Observer backed by a prometheus ObserverVec, which can be either a HistogramVec or a SummaryVec
func (LabelledObserverVec) Observe ¶
func (lov LabelledObserverVec) Observe(l *Labels, v float64)
type Labels ¶
type Labels struct {
// contains filtered or unexported fields
}
Labels provides a simple builder for name/value pairs. Go-kit and prometheus have different APIs that use labels. This type implements a common abstraction for both.
A nil Labels is valid, and behaves exactly like and empty Labels would.
func (*Labels) Add ¶
Add appends a name/value pair to this Labels instance. This instance is returned for method chaining.
The order in which name/value pairs are added matter. They should be added in the same order as the labels were defined.
func (*Labels) Labels ¶
Labels returns a map of the name/value pairs in this instance. This method can be used with prometheus metrics.
func (*Labels) NamesAndValues ¶
NamesAndValues returns the name/pair pairs in the order they were added. This method is useful when using go-kit metrics, as the With methods take name/value pairs as a string slice.
type MetricsOut ¶
type MetricsOut struct { fx.Out Registerer prometheus.Registerer Gatherer prometheus.Gatherer Factory Factory Registry Registry }
type Observer ¶
type Observer interface { // Observe posts a value to the underlying metric, applying Labels if non-nil and non-empty Observe(*Labels, float64) }
Observer is a strategy for observing series of values
type Options ¶
type Options struct { // DefaultNamespace is the prometheus namespace to apply when a metric has no namespace DefaultNamespace string // DefaultSubsystem is the prometheus subsystem to apply when a metric has no subsystem DefaultSubsystem string // Pedantic controls whether a pedantic Registerer is used as the prometheus backend. // See https://godoc.org/github.com/prometheus/client_golang/prometheus#NewPedanticRegistry Pedantic bool // DisableGoCollector controls whether the go collector is registered on startup. // By default, the go collector is registered. // // See https://godoc.org/github.com/prometheus/client_golang/prometheus#NewGoCollector DisableGoCollector bool // DisableProcessCollector controls whether the process collector is registered on startup. // By default, this collector is registered. // // See https://godoc.org/github.com/prometheus/client_golang/prometheus#NewProcessCollector DisableProcessCollector bool // ConstLabels is an optional map of constant labels and values that are applied to all // registered metrics. Useful for defining application-wide metrics, usually to distinguish // running instances in a cluster. ConstLabels map[string]string }
Options defines the configuration options for bootstrapping a prometheus-based metrics environment within an uber/fx App backed by Viper configuration.
type Registry ¶
type Registry interface { prometheus.Registerer prometheus.Gatherer Factory }
Registry is the central interface of this package. It implements the appropriate prometheus interfaces and supplies factory methods that return go-kit metrics types.
Directories ¶
Path | Synopsis |
---|---|
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0
|
SPDX-FileCopyrightText: 2017 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0 |