Documentation ¶
Index ¶
- Constants
- func Init(cfg *config.Server) error
- type Counter
- func (f *Counter) Add(value float64)
- func (f *Counter) Decrement()
- func (f *Counter) Increment()
- func (f *Counter) With(labelValues ...LabelValue) *Counter
- func (f *Counter) WithFailure(reason string, labelValues ...LabelValue) *Counter
- func (f *Counter) WithStatus(status string, labelValues ...LabelValue) *Counter
- func (f *Counter) WithSuccess(labelValues ...LabelValue) *Counter
- type Gauge
- type GaugeValues
- type Histogram
- type Label
- type LabelValue
- type Metadata
- type MetricOption
- type MetricOptions
- type MetricType
- type Unit
Constants ¶
const ( StatusSuccess = "success" StatusFailure = "failure" ReasonError = "error" ReasonConflict = "conflict" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter(name, description string, opts ...MetricOption) *Counter
NewCounter creates a new Counter Metric (the values will be cumulative). That means that data collected by the new Metric will be summed before export.
func (*Counter) With ¶
func (f *Counter) With(labelValues ...LabelValue) *Counter
func (*Counter) WithFailure ¶ added in v1.1.0
func (f *Counter) WithFailure(reason string, labelValues ...LabelValue) *Counter
func (*Counter) WithStatus ¶ added in v1.1.0
func (f *Counter) WithStatus(status string, labelValues ...LabelValue) *Counter
func (*Counter) WithSuccess ¶ added in v1.1.0
func (f *Counter) WithSuccess(labelValues ...LabelValue) *Counter
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
func NewGauge ¶
func NewGauge(name, description string, opts ...MetricOption) *Gauge
NewGauge creates a new Gauge Metric. That means that data collected by the new Metric will export only the last recorded value.
func (*Gauge) With ¶
func (f *Gauge) With(labelValues ...LabelValue) *Gauge
type GaugeValues ¶
type GaugeValues struct {
// contains filtered or unexported fields
}
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
func NewHistogram ¶
func NewHistogram(name, description string, bounds []float64, opts ...MetricOption) *Histogram
NewHistogram creates a new Metric with an aggregation type of Histogram. This means that the data collected by the Metric will be collected and exported as a histogram, with the specified bounds.
func (*Histogram) With ¶
func (f *Histogram) With(labelValues ...LabelValue) *Histogram
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
A Label provides a named dimension for a Metric.
func (Label) Value ¶
func (l Label) Value(value string) LabelValue
Value creates a new LabelValue for the Label.
type LabelValue ¶
type LabelValue struct {
// contains filtered or unexported fields
}
A LabelValue represents a Label with a specific value. It is used to record values for a Metric.
func (LabelValue) Key ¶
func (l LabelValue) Key() Label
func (LabelValue) Value ¶
func (l LabelValue) Value() string
type Metadata ¶
type Metadata struct { Name string Type MetricType Description string Bounds []float64 }
Metadata records a metric's metadata.
type MetricOption ¶
type MetricOption func(*MetricOptions)
MetricOption encode changes to the options passed to a Metric at creation time.
func WithUnit ¶
func WithUnit(unit Unit) MetricOption
WithUnit provides configuration options for a new Metric, providing unit of measure information for a new Metric.
type MetricOptions ¶
type MetricType ¶
type MetricType string
MetricType is the type of a metric.
const ( CounterType MetricType = "Counter" GaugeType MetricType = "Gauge" HistogramType MetricType = "Histogram" )