Documentation
¶
Index ¶
- func N(namespace, subsystem, name string) string
- func Time(t time.Time) float64
- type Label
- type Set
- func (s *Set) AddLabels(labels ...Label)
- func (s *Set) GetOrCreateCounter(name string, labels ...Label) *metrics.Counter
- func (s *Set) GetOrCreateFloatCounter(name string, labels ...Label) *metrics.FloatCounter
- func (s *Set) GetOrCreateGauge(name string, labels ...Label) *metrics.Gauge
- func (s *Set) GetOrCreateHistogram(name string, labels ...Label) *metrics.Histogram
- func (s *Set) GetOrCreatePrometheusHistogram(name string, labels ...Label) *metrics.PrometheusHistogram
- func (s *Set) GetOrCreatePrometheusHistogramExt(name string, upperBounds []float64, labels ...Label) *metrics.PrometheusHistogram
- func (s *Set) GetOrCreateSummary(name string, labels ...Label) *metrics.Summary
- func (s *Set) GetOrCreateSummaryExt(name string, window time.Duration, quantiles []float64, labels ...Label) *metrics.Summary
- func (s *Set) NewCounter(name string, labels ...Label) *metrics.Counter
- func (s *Set) NewFloatCounter(name string, labels ...Label) *metrics.FloatCounter
- func (s *Set) NewGauge(name string, labels ...Label) *metrics.Gauge
- func (s *Set) NewHistogram(name string, labels ...Label) *metrics.Histogram
- func (s *Set) NewPrometheusHistogram(name string, labels ...Label) *metrics.PrometheusHistogram
- func (s *Set) NewPrometheusHistogramExt(name string, upperBounds []float64, labels ...Label) *metrics.PrometheusHistogram
- func (s *Set) NewSummary(name string, labels ...Label) *metrics.Summary
- func (s *Set) NewSummaryExt(name string, window time.Duration, quantiles []float64, labels ...Label) *metrics.Summary
- func (s *Set) WritePrometheus(w io.Writer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label defines the metric label.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is the wrapper around metric set, adding standard labels to all the metrics.
func (*Set) GetOrCreateCounter ¶
GetOrCreateCounter returns registered counter in s with the given name or creates new counter if s doesn't contain counter with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned counter is safe to use from concurrent goroutines.
Performance tip: prefer NewCounter instead of GetOrCreateCounter.
func (*Set) GetOrCreateFloatCounter ¶
func (s *Set) GetOrCreateFloatCounter(name string, labels ...Label) *metrics.FloatCounter
GetOrCreateFloatCounter returns registered FloatCounter in s with the given name or creates new FloatCounter if s doesn't contain FloatCounter with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned FloatCounter is safe to use from concurrent goroutines.
Performance tip: prefer NewFloatCounter instead of GetOrCreateFloatCounter.
func (*Set) GetOrCreateGauge ¶
GetOrCreateGauge returns registered gauge with the given name in s or creates new gauge if s doesn't contain gauge with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned gauge is safe to use from concurrent goroutines.
Performance tip: prefer NewGauge instead of GetOrCreateGauge.
func (*Set) GetOrCreateHistogram ¶
GetOrCreateHistogram returns registered histogram in s with the given name or creates new histogram if s doesn't contain histogram with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
Performance tip: prefer NewHistogram instead of GetOrCreateHistogram.
func (*Set) GetOrCreatePrometheusHistogram ¶
func (s *Set) GetOrCreatePrometheusHistogram(name string, labels ...Label) *metrics.PrometheusHistogram
GetOrCreatePrometheusHistogram returns registered prometheus histogram in s with the given name or creates new histogram if s doesn't contain histogram with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
Performance tip: prefer NewPrometheusHistogram instead of GetOrCreatePrometheusHistogram.
func (*Set) GetOrCreatePrometheusHistogramExt ¶
func (s *Set) GetOrCreatePrometheusHistogramExt( name string, upperBounds []float64, labels ...Label, ) *metrics.PrometheusHistogram
GetOrCreatePrometheusHistogramExt returns registered prometheus histogram in s with the given name or creates new histogram if s doesn't contain histogram with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
Performance tip: prefer NewPrometheusHistogramExt instead of GetOrCreatePrometheusHistogramExt.
func (*Set) GetOrCreateSummary ¶
GetOrCreateSummary returns registered summary with the given name in s or creates new summary if s doesn't contain summary with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned summary is safe to use from concurrent goroutines.
Performance tip: prefer NewSummary instead of GetOrCreateSummary.
func (*Set) GetOrCreateSummaryExt ¶
func (s *Set) GetOrCreateSummaryExt( name string, window time.Duration, quantiles []float64, labels ...Label, ) *metrics.Summary
GetOrCreateSummaryExt returns registered summary with the given name, window and quantiles in s or creates new summary if s doesn't contain summary with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned summary is safe to use from concurrent goroutines.
Performance tip: prefer NewSummaryExt instead of GetOrCreateSummaryExt.
func (*Set) NewCounter ¶
NewCounter registers and returns new counter with the given name in the s.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned counter is safe to use from concurrent goroutines.
func (*Set) NewFloatCounter ¶
func (s *Set) NewFloatCounter(name string, labels ...Label) *metrics.FloatCounter
NewFloatCounter registers and returns new FloatCounter with the given name in the s.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned FloatCounter is safe to use from concurrent goroutines.
func (*Set) NewGauge ¶
NewGauge registers and returns gauge with the given name in s, which calls f to obtain gauge value.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
f must be safe for concurrent calls.
The returned gauge is safe to use from concurrent goroutines.
func (*Set) NewHistogram ¶
NewHistogram creates and returns new histogram in s with the given name.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
func (*Set) NewPrometheusHistogram ¶
func (s *Set) NewPrometheusHistogram(name string, labels ...Label) *metrics.PrometheusHistogram
NewPrometheusHistogram creates and returns new PrometheusHistogram in s with the given name and PrometheusHistogramDefaultBuckets.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
func (*Set) NewPrometheusHistogramExt ¶
func (s *Set) NewPrometheusHistogramExt( name string, upperBounds []float64, labels ...Label, ) *metrics.PrometheusHistogram
NewPrometheusHistogramExt creates and returns new PrometheusHistogram in s with the given name and upperBounds.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned histogram is safe to use from concurrent goroutines.
func (*Set) NewSummary ¶
NewSummary creates and returns new summary with the given name in s.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned summary is safe to use from concurrent goroutines.
func (*Set) NewSummaryExt ¶
func (s *Set) NewSummaryExt(name string, window time.Duration, quantiles []float64, labels ...Label) *metrics.Summary
NewSummaryExt creates and returns new summary in s with the given name, window and quantiles.
name must be valid Prometheus-compatible metric with possible labels. For instance,
- foo
- foo{bar="baz"}
- foo{bar="baz",aaa="b"}
The returned summary is safe to use from concurrent goroutines.
func (*Set) WritePrometheus ¶
WritePrometheus writes all the metrics from s to w in Prometheus format.