Documentation
¶
Overview ¶
Package metricrecorder defines the utilities to define and manage Prometheus metrics.
Index ¶
- type CounterVector
- type CounterVectorAdapter
- type DefaultCounterVector
- type DefaultGaugeVector
- func (d DefaultGaugeVector) Add(labels map[string]string, value float64)
- func (d DefaultGaugeVector) Dec(labels map[string]string)
- func (d DefaultGaugeVector) GetGaugeVectorAdapter() GaugeVectorAdapter
- func (d DefaultGaugeVector) Inc(labels map[string]string)
- func (d DefaultGaugeVector) Set(labels map[string]string, value float64)
- func (d DefaultGaugeVector) Sub(labels map[string]string, value float64)
- type DefaultHistogramVector
- type DefaultMetricRecorder
- func (recorder *DefaultMetricRecorder) NewCounterVector(name string, labels []string, help string) (CounterVector, error)
- func (recorder *DefaultMetricRecorder) NewGaugeVector(name string, labels []string, help string) (GaugeVector, error)
- func (recorder *DefaultMetricRecorder) NewHistogramVector(name string, labels []string, buckets []float64, help string) (HistogramVector, error)
- func (recorder *DefaultMetricRecorder) NewSummaryVector(name string, labels []string, help string) (SummaryVector, error)
- type DefaultMetricRecorderOptions
- type DefaultSummaryVector
- type GaugeVector
- type GaugeVectorAdapter
- type GaugeVectorArbitraryValueOptions
- type GaugeVectorOptions
- type HistogramVector
- type HistogramVectorAdapter
- type IncreaseCounterAdapterOptions
- type MetricRecorder
- type MetricsRecorderAdapter
- type NewCounterVectorAdapterOptions
- type NewGaugeAdapterOptions
- type NewHistogramAdapterOptions
- type NewSummaryAdapterOptions
- type NoCounterVector
- type NoGaugeVector
- func (n NoGaugeVector) Add(_ map[string]string, _ float64)
- func (n NoGaugeVector) Dec(_ map[string]string)
- func (n NoGaugeVector) GetGaugeVectorAdapter() GaugeVectorAdapter
- func (n NoGaugeVector) Inc(_ map[string]string)
- func (n NoGaugeVector) Set(_ map[string]string, _ float64)
- func (n NoGaugeVector) Sub(_ map[string]string, _ float64)
- type NoHistogramVector
- type NoMetricsRecorder
- func (n NoMetricsRecorder) NewCounterVector(_ string, _ []string, _ string) (CounterVector, error)
- func (n NoMetricsRecorder) NewGaugeVector(_ string, _ []string, _ string) (GaugeVector, error)
- func (n NoMetricsRecorder) NewHistogramVector(_ string, _ []string, _ []float64, _ string) (HistogramVector, error)
- func (n NoMetricsRecorder) NewSummaryVector(_ string, _ []string, _ string) (SummaryVector, error)
- type NoSummaryVector
- type ObserveHistogramVectorAdapterOptions
- type ObserveSummaryAdapterOptions
- type SummaryVector
- type SummaryVectorAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CounterVector ¶
type CounterVector interface { // Inc increases counter value Inc(labelsValues map[string]string) // GetCounterVectorAdapter returns the associated adapter GetCounterVectorAdapter() CounterVectorAdapter }
CounterVector defines the functionality of a counter metric
type CounterVectorAdapter ¶
type CounterVectorAdapter interface { // Inc increases counter value Inc(options IncreaseCounterAdapterOptions) }
CounterVectorAdapter defines the functionality of a counter metric adapter
type DefaultCounterVector ¶
type DefaultCounterVector struct {
// contains filtered or unexported fields
}
func (DefaultCounterVector) GetCounterVectorAdapter ¶
func (defaultCounter DefaultCounterVector) GetCounterVectorAdapter() CounterVectorAdapter
GetCounterVectorAdapter returns the associated adapter
func (DefaultCounterVector) Inc ¶
func (defaultCounter DefaultCounterVector) Inc(labelsValues map[string]string)
Inc increases counter value
type DefaultGaugeVector ¶
type DefaultGaugeVector struct {
// contains filtered or unexported fields
}
func (DefaultGaugeVector) Add ¶
func (d DefaultGaugeVector) Add(labels map[string]string, value float64)
Add adds the given value to the Gauge with provided labels The value can be negative, resulting in a decrease of the Gauge
func (DefaultGaugeVector) Dec ¶
func (d DefaultGaugeVector) Dec(labels map[string]string)
Dec decrements the Gauge with given labels by 1. Use Sub to decrement it by arbitrary values
func (DefaultGaugeVector) GetGaugeVectorAdapter ¶
func (d DefaultGaugeVector) GetGaugeVectorAdapter() GaugeVectorAdapter
GetGaugeVectorAdapter returns the associated adapter
func (DefaultGaugeVector) Inc ¶
func (d DefaultGaugeVector) Inc(labels map[string]string)
Inc increments the Gauge with given labels by 1. Use Add to increment it by arbitrary values
type DefaultHistogramVector ¶
type DefaultHistogramVector struct {
// contains filtered or unexported fields
}
func (DefaultHistogramVector) GetHistogramVectorAdapter ¶
func (dh DefaultHistogramVector) GetHistogramVectorAdapter() HistogramVectorAdapter
GetHistogramVectorAdapter returns the associated adapter
type DefaultMetricRecorder ¶
type DefaultMetricRecorder struct {
// contains filtered or unexported fields
}
func ProvideDefaultMetricRecorder ¶
func ProvideDefaultMetricRecorder(options DefaultMetricRecorderOptions) (*DefaultMetricRecorder, error)
ProvideDefaultMetricRecorder creates a DefaultMetricRecorder with the given DefaultMetricRecorderOptions
func (*DefaultMetricRecorder) NewCounterVector ¶
func (recorder *DefaultMetricRecorder) NewCounterVector(name string, labels []string, help string) (CounterVector, error)
NewCounterVector creates a CounterVector with the given name, labels and help
func (*DefaultMetricRecorder) NewGaugeVector ¶
func (recorder *DefaultMetricRecorder) NewGaugeVector(name string, labels []string, help string) (GaugeVector, error)
NewGaugeVector creates a GaugeVector with the given name, labels and help
func (*DefaultMetricRecorder) NewHistogramVector ¶
func (recorder *DefaultMetricRecorder) NewHistogramVector(name string, labels []string, buckets []float64, help string) (HistogramVector, error)
NewHistogramVector creates a HistogramVector with the given name, labels, buckets and help
func (*DefaultMetricRecorder) NewSummaryVector ¶
func (recorder *DefaultMetricRecorder) NewSummaryVector(name string, labels []string, help string) (SummaryVector, error)
NewSummaryVector creates a SummaryVector with the given name, labels and help
type DefaultMetricRecorderOptions ¶
type DefaultMetricRecorderOptions struct {
MetricsRecorderAdapter MetricsRecorderAdapter
}
DefaultMetricRecorderOptions defines the options to create a new DefaultMetricRecorder
type DefaultSummaryVector ¶
type DefaultSummaryVector struct {
// contains filtered or unexported fields
}
func (DefaultSummaryVector) GetSummaryVectorAdapter ¶
func (ds DefaultSummaryVector) GetSummaryVectorAdapter() SummaryVectorAdapter
GetSummaryVectorAdapter returns the associated adapter
type GaugeVector ¶
type GaugeVector interface { // Set sets the Gauge to an arbitrary value with given labels Set(labels map[string]string, value float64) // Inc increments the Gauge with given labels by 1. Use Add to increment it by arbitrary values Inc(labels map[string]string) // Dec decrements the Gauge with given labels by 1. Use Sub to decrement it by arbitrary values Dec(labels map[string]string) // Add adds the given value to the Gauge with provided labels // The value can be negative, resulting in a decrease of the Gauge Add(labels map[string]string, value float64) // Sub subtracts the given value from the Gauge with provided labels // The value can be negative, resulting in an increase of the Gauge Sub(labels map[string]string, value float64) // GetGaugeVectorAdapter returns the associated adapter GetGaugeVectorAdapter() GaugeVectorAdapter }
GaugeVector defines the functionality of a gauge metric
type GaugeVectorAdapter ¶
type GaugeVectorAdapter interface { // Set sets the Gauge to an arbitrary value with given labels Set(options GaugeVectorArbitraryValueOptions) // Inc increments the Gauge with given labels by 1. Use Add to increment it by arbitrary values Inc(options GaugeVectorOptions) // Dec decrements the Gauge with given labels by 1. Use Sub to decrement it by arbitrary values Dec(GaugeVectorOptions) // Add adds the given value to the Gauge with provided labels // The value can be negative, resulting in a decrease of the Gauge Add(options GaugeVectorArbitraryValueOptions) // Sub subtracts the given value from the Gauge with provided labels // The value can be negative, resulting in an increase of the Gauge Sub(options GaugeVectorArbitraryValueOptions) }
GaugeVectorAdapter defines the functionality of a gauge metric adapter
type GaugeVectorArbitraryValueOptions ¶
GaugeVectorArbitraryValueOptions defines the options to create a new GaugeVectorArbitraryValue
type GaugeVectorOptions ¶
GaugeVectorOptions defines the options to create a new GaugeVector
type HistogramVector ¶
type HistogramVector interface { // Observe increments the Histogram with given labels by 1 Observe(labels map[string]string, value float64) // GetHistogramVectorAdapter returns the associated adapter GetHistogramVectorAdapter() HistogramVectorAdapter }
HistogramVector defines the functionality of a histogram metric
type HistogramVectorAdapter ¶
type HistogramVectorAdapter interface { // Observe returns the associated adapter Observe(options ObserveHistogramVectorAdapterOptions) }
HistogramVectorAdapter defines the functionality of a histogram metric adapter
type IncreaseCounterAdapterOptions ¶
IncreaseCounterAdapterOptions defines the options to create a new IncreaseCounterAdapter
type MetricRecorder ¶
type MetricRecorder interface { // NewCounterVector creates a CounterVector with the given name, labels and help NewCounterVector(name string, labels []string, help string) (CounterVector, error) // NewHistogramVector creates a HistogramVector with the given name, labels and help NewHistogramVector(name string, labels []string, buckets []float64, help string) (HistogramVector, error) // NewGaugeVector creates a GaugeVector with the given name, labels and help NewGaugeVector(name string, labels []string, help string) (GaugeVector, error) // NewSummaryVector creates a SummaryVector with the given name, labels and help NewSummaryVector(name string, labels []string, help string) (SummaryVector, error) }
MetricRecorder defines the functionality of a metric recorder
type MetricsRecorderAdapter ¶
type MetricsRecorderAdapter interface { // NewCounterVector creates a CounterVectorAdapter with the given NewCounterVectorAdapterOptions NewCounterVector(options NewCounterVectorAdapterOptions) (CounterVectorAdapter, error) // NewHistogramVector creates a HistogramVectorAdapter with the given NewHistogramAdapterOptions NewHistogramVector(options NewHistogramAdapterOptions) (HistogramVectorAdapter, error) // NewGauge creates a GaugeVectorAdapter with the given NewGaugeAdapterOptions NewGauge(options NewGaugeAdapterOptions) (GaugeVectorAdapter, error) // NewSummary creates a SummaryVectorAdapter with the given NewSummaryAdapterOptions NewSummary(options NewSummaryAdapterOptions) (SummaryVectorAdapter, error) }
MetricsRecorderAdapter defines the functionality of a metric recorder adapter
type NewCounterVectorAdapterOptions ¶
type NewCounterVectorAdapterOptions struct { // Name of the metric Name string // Help string accompanying the metric Help string // Array of labels of the metric dimensions Labels []string }
NewCounterVectorAdapterOptions defines the options to create a new NewCounterVectorAdapter
type NewGaugeAdapterOptions ¶
type NewGaugeAdapterOptions struct { // Name of the metric Name string // Help string accompanying the metric Help string // Array of labels of the metric dimensions Labels []string }
NewGaugeAdapterOptions defines the options to create a new NewGaugeAdapter
type NewHistogramAdapterOptions ¶
type NewHistogramAdapterOptions struct { // Name of the metric Name string // Help string accompanying the metric Help string // Array of labels of the metric dimensions Labels []string // Array of buckets to record measurements Buckets []float64 }
NewHistogramAdapterOptions defines the options to create a new NewHistogramAdapter
type NewSummaryAdapterOptions ¶
type NewSummaryAdapterOptions struct { // Name of the metric Name string // Help string accompanying the metric Help string // Array of labels of the metric dimensions Labels []string }
NewSummaryAdapterOptions defines the options to create a new NewSummaryAdapter
type NoCounterVector ¶
type NoCounterVector struct { }
func (NoCounterVector) GetCounterVectorAdapter ¶
func (n NoCounterVector) GetCounterVectorAdapter() CounterVectorAdapter
GetCounterVectorAdapter is a stub that does nothing
func (NoCounterVector) Inc ¶
func (n NoCounterVector) Inc(_ map[string]string)
Inc is a stub that does nothing
type NoGaugeVector ¶
type NoGaugeVector struct { }
func (NoGaugeVector) Add ¶
func (n NoGaugeVector) Add(_ map[string]string, _ float64)
Add is a stub that does nothing
func (NoGaugeVector) Dec ¶
func (n NoGaugeVector) Dec(_ map[string]string)
Dec is a stub that does nothing
func (NoGaugeVector) GetGaugeVectorAdapter ¶
func (n NoGaugeVector) GetGaugeVectorAdapter() GaugeVectorAdapter
GetGaugeVectorAdapter is a stub that does nothing
func (NoGaugeVector) Inc ¶
func (n NoGaugeVector) Inc(_ map[string]string)
Inc is a stub that does nothing
type NoHistogramVector ¶
type NoHistogramVector struct { }
func (NoHistogramVector) GetHistogramVectorAdapter ¶
func (n NoHistogramVector) GetHistogramVectorAdapter() HistogramVectorAdapter
GetHistogramVectorAdapter is a stub that does nothing
type NoMetricsRecorder ¶
type NoMetricsRecorder struct { }
NoMetricsRecorder provides an implementation of MetricRecorder that doesn't collect any metric It is provided for those scenarios where metrics are not needed or want to be disabled for whatever reason
func NewNoMetricsRecorder ¶
func NewNoMetricsRecorder() *NoMetricsRecorder
func (NoMetricsRecorder) NewCounterVector ¶
func (n NoMetricsRecorder) NewCounterVector(_ string, _ []string, _ string) (CounterVector, error)
NewCounterVector creates a CounterVector with the given name and labels
func (NoMetricsRecorder) NewGaugeVector ¶
func (n NoMetricsRecorder) NewGaugeVector(_ string, _ []string, _ string) (GaugeVector, error)
NewGaugeVector creates a GaugeVector with the given name and labels
func (NoMetricsRecorder) NewHistogramVector ¶
func (n NoMetricsRecorder) NewHistogramVector(_ string, _ []string, _ []float64, _ string) (HistogramVector, error)
NewHistogramVector creates a HistogramVector with the given name and labels
func (NoMetricsRecorder) NewSummaryVector ¶
func (n NoMetricsRecorder) NewSummaryVector(_ string, _ []string, _ string) (SummaryVector, error)
NewSummaryVector creates a SummaryVector with the given name and labels
type NoSummaryVector ¶
type NoSummaryVector struct { }
func (NoSummaryVector) GetSummaryVectorAdapter ¶
func (n NoSummaryVector) GetSummaryVectorAdapter() SummaryVectorAdapter
GetSummaryVectorAdapter is a stub that does nothing
type ObserveHistogramVectorAdapterOptions ¶
ObserveHistogramVectorAdapterOptions defines the options to create a new HistogramVectorAdapter
type ObserveSummaryAdapterOptions ¶
ObserveSummaryAdapterOptions options to create a new ObserveSummaryAdapter
type SummaryVector ¶
type SummaryVector interface { // Observe increments the Summary with given labels by 1 Observe(labels map[string]string, value float64) // GetSummaryVectorAdapter returns the associated adapter GetSummaryVectorAdapter() SummaryVectorAdapter }
SummaryVector defines the functionality of a summary metric
type SummaryVectorAdapter ¶
type SummaryVectorAdapter interface { // Observe increments the Summary with given labels by 1 Observe(options ObserveSummaryAdapterOptions) }
SummaryVectorAdapter defines the functionality of a summary metric