metric

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	metrics.Metadata
	// contains filtered or unexported fields
}

A Counter holds a single mutable atomic value.

Can be used to record indicator types that will only increase and not decrease.

func NewCounter

func NewCounter(metadata metrics.Metadata) *Counter

NewCounter creates a counter.

func (*Counter) Clear

func (c *Counter) Clear()

Clear sets the counter to zero.

func (*Counter) Count

func (c *Counter) Count() int64

Count returns the current count.

func (*Counter) ExportMetric

func (c *Counter) ExportMetric() *metrics.MetricData

ExportMetric returns a filled-in metric data of the right type for the given metric.

func (*Counter) GetMetadata

func (c *Counter) GetMetadata() metrics.Metadata

GetMetadata return the metadata of Counter.

func (*Counter) GetType

func (c *Counter) GetType() metrics.MetricType

GetType returns the type enum for this metric.

func (*Counter) Inc

func (c *Counter) Inc(i int64)

Inc increments the counter by the given amount.

func (*Counter) Inspect

func (c *Counter) Inspect(f func(metrics.Metric))

Inspect calls the closure with the empty string and the receiver.

func (*Counter) Snapshot

func (c *Counter) Snapshot() *Counter

type CounterRate

type CounterRate struct {
	Counter
	// contains filtered or unexported fields
}

CounterRate is a wrapper around a counter.

func NewCounterRate

func NewCounterRate(metadata metrics.Metadata) *CounterRate

NewCounterRate creates a CounterRate.

func (*CounterRate) Clear

func (c *CounterRate) Clear()

Clear sets the counter to zero.

func (*CounterRate) ExportMetric

func (c *CounterRate) ExportMetric() *metrics.MetricData

ExportMetric returns a filled-in metric data of the right type for the given metric.

func (*CounterRate) GetType

func (c *CounterRate) GetType() metrics.MetricType

GetType returns the type enum for this metric.

type Gauge

type Gauge struct {
	metrics.Metadata
	// contains filtered or unexported fields
}

Gauge atomically stores a single integer value.

An incremental and subtractable dashboard

func NewGauge

func NewGauge(metadata metrics.Metadata) *Gauge

NewGauge creates a Gauge.

func (*Gauge) Dec

func (g *Gauge) Dec(i int64)

Dec decrements the gauge's value.

func (*Gauge) ExportMetric

func (g *Gauge) ExportMetric() *metrics.MetricData

ExportMetric returns a filled-in metric data of the right type for the given metric.

func (*Gauge) GetMetadata

func (g *Gauge) GetMetadata() metrics.Metadata

GetMetadata return the metadata of Gauge.

func (*Gauge) GetType

func (g *Gauge) GetType() metrics.MetricType

GetType returns the type enum for this metric.

func (*Gauge) Inc

func (g *Gauge) Inc(i int64)

Inc increments the gauge's value.

func (*Gauge) Inspect

func (g *Gauge) Inspect(f func(metrics.Metric))

Inspect calls the closure with the empty string and the receiver.

func (*Gauge) Snapshot

func (g *Gauge) Snapshot() *Gauge

Snapshot returns a read-only copy of the gauge.

func (*Gauge) Update

func (g *Gauge) Update(v int64)

Update updates the gauge's value.

func (*Gauge) Value

func (g *Gauge) Value() int64

Value returns the gauge's current value.

type GaugeFloat64

type GaugeFloat64 struct {
	metrics.Metadata
	// contains filtered or unexported fields
}

A GaugeFloat64 atomically stores a single float64 value.

func NewGaugeFloat64

func NewGaugeFloat64(metadata metrics.Metadata) *GaugeFloat64

NewGaugeFloat64 creates a GaugeFloat64.

func (*GaugeFloat64) ExportMetric

func (g *GaugeFloat64) ExportMetric() *metrics.MetricData

ExportMetric returns a filled-in metric data of the right type for the given metric.

func (*GaugeFloat64) GetMetadata

func (g *GaugeFloat64) GetMetadata() metrics.Metadata

GetMetadata return the metadata of Gauge.

func (*GaugeFloat64) GetType

func (g *GaugeFloat64) GetType() metrics.MetricType

GetType returns the type enum for this metric.

func (*GaugeFloat64) Inspect

func (g *GaugeFloat64) Inspect(f func(metrics.Metric))

Inspect calls the closure with the empty string and the receiver.

func (*GaugeFloat64) Snapshot

func (g *GaugeFloat64) Snapshot() *GaugeFloat64

Snapshot returns a read-only copy of the gauge.

func (*GaugeFloat64) Update

func (g *GaugeFloat64) Update(v float64)

Update updates the gauge's value.

func (*GaugeFloat64) Value

func (g *GaugeFloat64) Value() float64

Value returns the gauge's current value.

type Histogram

type Histogram struct {
	metrics.Metadata

	sync.Mutex
	// contains filtered or unexported fields
}

Histogram collects observed values by keeping bucketed counts. There are two sets of buckets: A cumulative set and a windowed set. Recording a value in excess of the maxVal results in recording the maxVal instead.

Used primarily to record size or number of events occurring within a specified distribution range (Buckets).

func NewHistogram

func NewHistogram(metadata metrics.Metadata, duration time.Duration, maxVal int64, sigFigs int) *Histogram

NewHistogram initializes a given Histogram. The window histogram rotates every 'duration'; both the windowed and the cumulative histogram track nonnegative values up to 'maxVal' with 'sigFigs' decimal points of precision.

func NewHistogramLatency

func NewHistogramLatency(metadata metrics.Metadata, duration time.Duration) *Histogram

NewHistogramLatency is a convenience function which returns a histogram with suitable defaults for latency tracking.

func (*Histogram) ExportMetric

func (h *Histogram) ExportMetric() *metrics.MetricData

ExportMetric returns a filled-in metric data of the right type for the given metric.

func (*Histogram) GetMetadata

func (h *Histogram) GetMetadata() metrics.Metadata

GetMetadata return the metadata of Histogram

func (*Histogram) GetType

func (h *Histogram) GetType() metrics.MetricType

GetType returns the type enum for this metric.

func (*Histogram) Inspect

func (h *Histogram) Inspect(f func(metrics.Metric))

Inspect calls the closure with the empty string and the receiver.

func (*Histogram) Min

func (h *Histogram) Min() (min int64)

Min returns the minimum.

func (*Histogram) RecordValue

func (h *Histogram) RecordValue(v int64)

RecordValue adds the given value to the histogram.

func (*Histogram) Snapshot

func (h *Histogram) Snapshot() (hist *hdrhistogram.Histogram)

Snapshot returns a copy of the cumulative histogram data.

func (*Histogram) TotalCount

func (h *Histogram) TotalCount() (count int64)

TotalCount returns the (cumulative) number of samples.

func (*Histogram) Windowed

func (h *Histogram) Windowed() (hist *hdrhistogram.Histogram, duration time.Duration)

Windowed returns a copy of the current windowed histogram data and its rotation interval.

Jump to

Keyboard shortcuts

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