aggmetric

package
v0.0.0-...-1dc08c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package aggmetric provides functionality to create metrics which expose aggregate metrics for internal collection and additionally per-child reporting to prometheus.

Index

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

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 NewGauge

func NewGauge(metadata metric.Metadata, childLabels ...string) *AggGauge

NewGauge constructs a new AggGauge.

func (*AggGauge) AddChild

func (g *AggGauge) AddChild(labelVals ...string) *Gauge

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) GetHelp

func (g *AggGauge) GetHelp() string

GetHelp is part of the metric.Iterable interface.

func (*AggGauge) GetLabels

func (g *AggGauge) GetLabels() []*io_prometheus_client.LabelPair

GetLabels is part of the metric.PrometheusExportable interface.

func (*AggGauge) GetMeasurement

func (g *AggGauge) GetMeasurement() string

GetMeasurement is part of the metric.Iterable interface.

func (*AggGauge) GetMetadata

func (g *AggGauge) GetMetadata() metric.Metadata

GetMetadata is part of the metric.Iterable interface.

func (*AggGauge) GetName

func (g *AggGauge) GetName() string

GetName is part of the metric.Iterable interface.

func (*AggGauge) GetType

GetType is part of the metric.PrometheusExportable interface.

func (*AggGauge) GetUnit

func (g *AggGauge) GetUnit() metric.Unit

GetUnit is part of the metric.Iterable 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.

func (*AggGauge) Value

func (g *AggGauge) Value() int64

Value returns the aggregate sum of all of its current children.

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) Inc

func (g *Counter) Inc(i int64)

Inc increments the AggCounter's value.

func (*Counter) Less

func (lv *Counter) Less(o bast.Item) bool

func (*Counter) ToPrometheusMetric

func (g *Counter) ToPrometheusMetric() *io_prometheus_client.Metric

ToPrometheusMetric constructs a prometheus metric for this Counter.

func (*Counter) Value

func (g *Counter) Value() int64

Value returns the AggCounter's current value.

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) Dec

func (g *Gauge) Dec(i int64)

Dec decrements the gauge's value.

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) Inc

func (g *Gauge) Inc(i int64)

Inc increments the gauge's value.

func (*Gauge) Less

func (lv *Gauge) Less(o bast.Item) bool

func (*Gauge) ToPrometheusMetric

func (g *Gauge) ToPrometheusMetric() *io_prometheus_client.Metric

ToPrometheusMetric constructs a prometheus metric for this Gauge.

func (*Gauge) Value

func (g *Gauge) Value() int64

Value returns the gauge's current value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL