Documentation ¶
Overview ¶
Package aggmetric provides functionality to create metrics which expose aggregate metrics for internal collection and additionally per-child reporting to prometheus.
Index ¶
- type AggCounter
- func (c *AggCounter) AddChild(labelVals ...string) *Counter
- func (c *AggCounter) Count() int64
- func (cs *AggCounter) Each(labels []*io_prometheus_client.LabelPair, ...)
- func (c *AggCounter) GetHelp() string
- func (c *AggCounter) GetLabels() []*io_prometheus_client.LabelPair
- func (c *AggCounter) GetMeasurement() string
- func (c *AggCounter) GetMetadata() metric.Metadata
- func (c *AggCounter) GetName() string
- func (c *AggCounter) GetType() *io_prometheus_client.MetricType
- func (c *AggCounter) GetUnit() metric.Unit
- func (c *AggCounter) Inspect(f func(interface{}))
- func (c *AggCounter) ToPrometheusMetric() *io_prometheus_client.Metric
- type AggGauge
- func (g *AggGauge) AddChild(labelVals ...string) *Gauge
- func (cs *AggGauge) Each(labels []*io_prometheus_client.LabelPair, ...)
- func (g *AggGauge) GetHelp() string
- func (g *AggGauge) GetLabels() []*io_prometheus_client.LabelPair
- func (g *AggGauge) GetMeasurement() string
- func (g *AggGauge) GetMetadata() metric.Metadata
- func (g *AggGauge) GetName() string
- func (g *AggGauge) GetType() *io_prometheus_client.MetricType
- func (g *AggGauge) GetUnit() metric.Unit
- func (g *AggGauge) Inspect(f func(interface{}))
- func (g *AggGauge) ToPrometheusMetric() *io_prometheus_client.Metric
- func (g *AggGauge) Value() int64
- type Counter
- type Gauge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggCounter ¶
type AggCounter struct {
// contains filtered or unexported fields
}
AggCounter maintains a value as the sum of its children. The counter will report to crdb-internal time series only the aggregate sum of all of its children, while its children are additionally exported to prometheus via the PrometheusIterable interface.
func NewCounter ¶
func NewCounter(metadata metric.Metadata, childLabels ...string) *AggCounter
NewCounter constructs a new AggCounter.
func (*AggCounter) AddChild ¶
func (c *AggCounter) AddChild(labelVals ...string) *Counter
AddChild adds a Counter to this AggCounter. This method panics if a Counter already exists for this set of labelVals.
func (*AggCounter) Count ¶
func (c *AggCounter) Count() int64
Count returns the aggregate count of all of its current and past children.
func (*AggCounter) Each ¶
func (cs *AggCounter) Each( labels []*io_prometheus_client.LabelPair, f func(metric *io_prometheus_client.Metric), )
func (*AggCounter) GetHelp ¶
func (c *AggCounter) GetHelp() string
GetHelp is part of the metric.Iterable interface.
func (*AggCounter) GetLabels ¶
func (c *AggCounter) GetLabels() []*io_prometheus_client.LabelPair
GetLabels is part of the metric.PrometheusExportable interface.
func (*AggCounter) GetMeasurement ¶
func (c *AggCounter) GetMeasurement() string
GetMeasurement is part of the metric.Iterable interface.
func (*AggCounter) GetMetadata ¶
func (c *AggCounter) GetMetadata() metric.Metadata
GetMetadata is part of the metric.Iterable interface.
func (*AggCounter) GetName ¶
func (c *AggCounter) GetName() string
GetName is part of the metric.Iterable interface.
func (*AggCounter) GetType ¶
func (c *AggCounter) GetType() *io_prometheus_client.MetricType
GetType is part of the metric.PrometheusExportable interface.
func (*AggCounter) GetUnit ¶
func (c *AggCounter) GetUnit() metric.Unit
GetUnit is part of the metric.Iterable interface.
func (*AggCounter) Inspect ¶
func (c *AggCounter) Inspect(f func(interface{}))
Inspect is part of the metric.Iterable interface.
func (*AggCounter) ToPrometheusMetric ¶
func (c *AggCounter) ToPrometheusMetric() *io_prometheus_client.Metric
ToPrometheusMetric is part of the metric.PrometheusExportable interface.
type AggGauge ¶
type AggGauge struct {
// contains filtered or unexported fields
}
AggGauge maintains a value as the sum of its children. The gauge will report to crdb-internal time series only the aggregate sum of all of its children, while its children are additionally exported to prometheus via the PrometheusIterable interface.
func (*AggGauge) AddChild ¶
AddChild adds a Gauge to this AggGauge. This method panics if a Gauge already exists for this set of labelVals.
func (*AggGauge) Each ¶
func (cs *AggGauge) Each( labels []*io_prometheus_client.LabelPair, f func(metric *io_prometheus_client.Metric), )
func (*AggGauge) GetLabels ¶
func (g *AggGauge) GetLabels() []*io_prometheus_client.LabelPair
GetLabels is part of the metric.PrometheusExportable interface.
func (*AggGauge) GetMeasurement ¶
GetMeasurement is part of the metric.Iterable interface.
func (*AggGauge) GetMetadata ¶
GetMetadata is part of the metric.Iterable interface.
func (*AggGauge) GetType ¶
func (g *AggGauge) GetType() *io_prometheus_client.MetricType
GetType is part of the metric.PrometheusExportable interface.
func (*AggGauge) Inspect ¶
func (g *AggGauge) Inspect(f func(interface{}))
Inspect is part of the metric.Iterable interface.
func (*AggGauge) ToPrometheusMetric ¶
func (g *AggGauge) ToPrometheusMetric() *io_prometheus_client.Metric
ToPrometheusMetric is part of the metric.PrometheusExportable interface.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a child of a AggCounter. When it is incremented, so too is the parent. When metrics are collected by prometheus, each of the children will appear with a distinct label, however, when cockroach internally collects metrics, only the parent is collected.
func (*Counter) Destroy ¶
func (g *Counter) Destroy()
Destroy disconnects this Counter from its parents. Unlike Gauge.Destroy, it does not decrement its value from its parent.
func (*Counter) ToPrometheusMetric ¶
func (g *Counter) ToPrometheusMetric() *io_prometheus_client.Metric
ToPrometheusMetric constructs a prometheus metric for this Counter.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a child of a AggGauge. When it is incremented or decremented, so too is the parent. When metrics are collected by prometheus, each of the children will appear with a distinct label, however, when cockroach internally collects metrics, only the parent is collected.
func (*Gauge) Destroy ¶
func (g *Gauge) Destroy()
Destroy is used to destroy the gauge associated with this child. The value of the Gauge will be decremented from its parent.
func (*Gauge) ToPrometheusMetric ¶
func (g *Gauge) ToPrometheusMetric() *io_prometheus_client.Metric
ToPrometheusMetric constructs a prometheus metric for this Gauge.