statz

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package statz used to wrap OpenCensus metric collection

Index

Constants

This section is empty.

Variables

View Source
var LatencyDistribution = DistributionFromBounds(0, 5, 25, 50, 75, 100, 200, 400, 600, 800, 1000, 2000, 4000, 6000)

LatencyDistribution is a basic latency distribution.

Functions

This section is empty.

Types

type Counter0

type Counter0 struct {
	// contains filtered or unexported fields
}

Counter0 is a incremental int64 counter type with no metric labels.

func NewCounter0

func NewCounter0(name string, cfg MetricConfig) Counter0

NewCounter0 creates a new counter metric with 0 labels.

func (*Counter0) Inc

func (c *Counter0) Inc()

Inc increments counter by 1.

func (*Counter0) IncBy

func (c *Counter0) IncBy(by int64)

IncBy increments counter by X.

type Counter1

type Counter1[T1 labelContraint] struct {
	// contains filtered or unexported fields
}

Counter1 is a incremental int64 counter type with 1 metric label.

func NewCounter1

func NewCounter1[T1 labelContraint](name string, cfg MetricConfig) Counter1[T1]

NewCounter1 creates a new counter metric with 1 labels.

func (*Counter1[T1]) Inc

func (c *Counter1[T1]) Inc(v1 T1)

Inc increments counter by 1.

func (*Counter1[T1]) IncBy

func (c *Counter1[T1]) IncBy(v1 T1, by int64)

IncBy increments counter by X.

type Counter2

type Counter2[T1 labelContraint, T2 labelContraint] struct {
	// contains filtered or unexported fields
}

Counter2 is a incremental int64 counter type with 2 metric label.

func NewCounter2

func NewCounter2[T1, T2 labelContraint](name string, cfg MetricConfig) Counter2[T1, T2]

NewCounter2 creates a new counter metric with 2 labels.

func (*Counter2[T1, T2]) Inc

func (c *Counter2[T1, T2]) Inc(v1 T1, v2 T2)

Inc increments counter by 1.

func (*Counter2[T1, T2]) IncBy

func (c *Counter2[T1, T2]) IncBy(v1 T1, v2 T2, by int64)

IncBy increments counter by X.

type Counter3

type Counter3[T1 labelContraint, T2 labelContraint, T3 labelContraint] struct {
	// contains filtered or unexported fields
}

Counter3 is a incremental int64 counter type with 3 metric label.

func NewCounter3

func NewCounter3[T1, T2, T3 labelContraint](name string, cfg MetricConfig) Counter3[T1, T2, T3]

NewCounter3 creates a new counter metric with 3 labels.

func (*Counter3[T1, T2, T3]) Inc

func (c *Counter3[T1, T2, T3]) Inc(v1 T1, v2 T2, v3 T3)

Inc increments counter by 1.

func (*Counter3[T1, T2, T3]) IncBy

func (c *Counter3[T1, T2, T3]) IncBy(v1 T1, v2 T2, v3 T3, by int64)

IncBy increments counter by X.

type Counter4

type Counter4[T1 labelContraint, T2 labelContraint, T3 labelContraint, T4 labelContraint] struct {
	// contains filtered or unexported fields
}

Counter4 is a incremental int64 counter type with 4 metric label.

func NewCounter4

func NewCounter4[T1, T2 labelContraint,
	T3, T4 labelContraint](name string, cfg MetricConfig,
) Counter4[T1, T2, T3, T4]

NewCounter4 creates a new counter metric with 4 labels.

func (*Counter4[T1, T2, T3, T4]) Inc

func (c *Counter4[T1, T2, T3, T4]) Inc(v1 T1, v2 T2, v3 T3, v4 T4)

Inc increments counter by 1.

func (*Counter4[T1, T2, T3, T4]) IncBy

func (c *Counter4[T1, T2, T3, T4]) IncBy(v1 T1, v2 T2, v3 T3, v4 T4, by int64)

IncBy increments counter by X.

type Distribution

type Distribution struct {
	// contains filtered or unexported fields
}

Distribution contains hisogram buckets for metric of distribution type.

func DistributionFromBounds

func DistributionFromBounds(bounds ...float64) Distribution

DistributionFromBounds create distribution from a list of bounds. Must be incrementing and non-overlapping.

type Distribution0

type Distribution0 struct {
	// contains filtered or unexported fields
}

Distribution0 is a float64 histogram metic. Good for latencies.

func NewDistribution0

func NewDistribution0(name string, cfg MetricConfig, distribution Distribution) Distribution0

NewDistribution0 creates a new distribution metric with 0 labels.

func (*Distribution0) Observe

func (c *Distribution0) Observe(v float64)

Observe records an observation of the metric.

type Distribution1

type Distribution1[T1 labelContraint] struct {
	// contains filtered or unexported fields
}

Distribution1 is a float64 histogram metic. Good for latencies.

func NewDistribution1

func NewDistribution1[T1 labelContraint](name string, cfg MetricConfig, distribution Distribution) Distribution1[T1]

NewDistribution1 creates a new distribution metric with 1 labels.

func (*Distribution1[T1]) Observe

func (c *Distribution1[T1]) Observe(v float64, l1 T1)

Observe records an observation of the metric.

type Distribution2

type Distribution2[T1 labelContraint, T2 labelContraint] struct {
	// contains filtered or unexported fields
}

Distribution2 is a float64 histogram metic. Good for latencies.

func NewDistribution2

func NewDistribution2[T1, T2 labelContraint](name string,
	cfg MetricConfig, distribution Distribution,
) Distribution2[T1, T2]

NewDistribution2 creates a new distribution metric with 2 labels.

func (*Distribution2[T1, T2]) Observe

func (c *Distribution2[T1, T2]) Observe(v float64, l1 T1, l2 T2)

Observe records an observation of the metric.

type Distribution3

type Distribution3[T1 labelContraint, T2 labelContraint, T3 labelContraint] struct {
	// contains filtered or unexported fields
}

Distribution3 is a float64 histogram metic. Good for latencies.

func NewDistribution3

func NewDistribution3[T1, T2, T3 labelContraint](name string,
	cfg MetricConfig, distribution Distribution,
) Distribution3[T1, T2, T3]

NewDistribution3 creates a new distribution metric with 3 labels.

func (*Distribution3[T1, T2, T3]) Observe

func (c *Distribution3[T1, T2, T3]) Observe(v float64, l1 T1, l2 T2, l3 T3)

Observe records an observation of the metric.

type Distribution4

type Distribution4[T1 labelContraint, T2 labelContraint, T3 labelContraint, T4 labelContraint] struct {
	// contains filtered or unexported fields
}

Distribution4 is a float64 histogram metic. Good for latencies.

func NewDistribution4

func NewDistribution4[T1, T2, T3, T4 labelContraint](name string,
	cfg MetricConfig, distribution Distribution,
) Distribution4[T1, T2, T3, T4]

NewDistribution4 creates a new distribution metric with 4 labels.

func (*Distribution4[T1, T2, T3, T4]) Observe

func (c *Distribution4[T1, T2, T3, T4]) Observe(v float64, l1 T1, l2 T2, l3 T3, l4 T4)

Observe records an observation of the metric.

type Gauge0 added in v0.1.14

type Gauge0 struct {
	// contains filtered or unexported fields
}

Gauge0 is an int64 gauge type with no metric labels.

func NewGauge0 added in v0.1.14

func NewGauge0(name string, cfg MetricConfig) Gauge0

NewGauge0 creates a new gauge metric with 0 labels.

func (*Gauge0) Set added in v0.1.14

func (c *Gauge0) Set(to int64)

Set sets gauge to X.

type Gauge1 added in v0.1.14

type Gauge1[T1 labelContraint] struct {
	// contains filtered or unexported fields
}

Gauge1 is an int64 gauge type with 1 metric label.

func NewGauge1 added in v0.1.14

func NewGauge1[T1 labelContraint](name string, cfg MetricConfig) Gauge1[T1]

NewGauge1 creates a new gauge metric with 1 labels.

func (*Gauge1[T1]) Set added in v0.1.14

func (c *Gauge1[T1]) Set(v1 T1, to int64)

Set sets gauge to X.

type Gauge2 added in v0.1.14

type Gauge2[T1 labelContraint, T2 labelContraint] struct {
	// contains filtered or unexported fields
}

Gauge2 is an int64 gauge type with 2 metric label.

func NewGauge2 added in v0.1.14

func NewGauge2[T1, T2 labelContraint](name string, cfg MetricConfig) Gauge2[T1, T2]

NewGauge2 creates a new gauge metric with 2 labels.

func (*Gauge2[T1, T2]) Set added in v0.1.14

func (c *Gauge2[T1, T2]) Set(v1 T1, v2 T2, to int64)

Set sets gauge to X.

type Gauge3 added in v0.1.14

type Gauge3[T1 labelContraint, T2 labelContraint, T3 labelContraint] struct {
	// contains filtered or unexported fields
}

Gauge3 is an int64 gauge type with 3 metric label.

func NewGauge3 added in v0.1.14

func NewGauge3[T1, T2, T3 labelContraint](name string, cfg MetricConfig) Gauge3[T1, T2, T3]

NewGauge3 creates a new gauge metric with 3 labels.

func (*Gauge3[T1, T2, T3]) Set added in v0.1.14

func (c *Gauge3[T1, T2, T3]) Set(v1 T1, v2 T2, v3 T3, to int64)

Set sets gauge to X.

type Gauge4 added in v0.1.14

type Gauge4[T1 labelContraint, T2 labelContraint, T3 labelContraint, T4 labelContraint] struct {
	// contains filtered or unexported fields
}

Gauge4 is an int64 gauge type with 4 metric label.

func NewGauge4 added in v0.1.14

func NewGauge4[T1, T2 labelContraint,
	T3, T4 labelContraint](name string, cfg MetricConfig,
) Gauge4[T1, T2, T3, T4]

NewGauge4 creates a new gauge metric with 4 labels.

func (*Gauge4[T1, T2, T3, T4]) Set added in v0.1.14

func (c *Gauge4[T1, T2, T3, T4]) Set(v1 T1, v2 T2, v3 T3, v4 T4, to int64)

Set sets gauge to X.

type Label

type Label struct {
	Name        string
	Description string
}

Label holds the metadata associated for each label.

type MetricConfig

type MetricConfig struct {
	Description string
	Unit        units.Unit
	Labels      []Label
}

MetricConfig defines a single metric at program startup and holds all associated metadata.

type Summation0 added in v0.1.14

type Summation0 struct {
	// contains filtered or unexported fields
}

Summation0 is a incremental int64 summation type with no metric labels.

func NewSummation0 added in v0.1.14

func NewSummation0(name string, cfg MetricConfig) Summation0

NewSummation0 creates a new summation metric with 0 labels.

func (*Summation0) Inc added in v0.1.14

func (c *Summation0) Inc()

Inc increments summation by 1.

func (*Summation0) IncBy added in v0.1.14

func (c *Summation0) IncBy(by int64)

IncBy increments summation by X.

type Summation1 added in v0.1.14

type Summation1[T1 labelContraint] struct {
	// contains filtered or unexported fields
}

Summation1 is a incremental int64 summation type with 1 metric label.

func NewSummation1 added in v0.1.14

func NewSummation1[T1 labelContraint](name string, cfg MetricConfig) Summation1[T1]

NewSummation1 creates a new summation metric with 1 labels.

func (*Summation1[T1]) Inc added in v0.1.14

func (c *Summation1[T1]) Inc(v1 T1)

Inc increments summation by 1.

func (*Summation1[T1]) IncBy added in v0.1.14

func (c *Summation1[T1]) IncBy(v1 T1, by int64)

IncBy increments summation by X.

type Summation2 added in v0.1.14

type Summation2[T1 labelContraint, T2 labelContraint] struct {
	// contains filtered or unexported fields
}

Summation2 is a incremental int64 summation type with 2 metric label.

func NewSummation2 added in v0.1.14

func NewSummation2[T1, T2 labelContraint](name string, cfg MetricConfig) Summation2[T1, T2]

NewSummation2 creates a new summation metric with 2 labels.

func (*Summation2[T1, T2]) Inc added in v0.1.14

func (c *Summation2[T1, T2]) Inc(v1 T1, v2 T2)

Inc increments summation by 1.

func (*Summation2[T1, T2]) IncBy added in v0.1.14

func (c *Summation2[T1, T2]) IncBy(v1 T1, v2 T2, by int64)

IncBy increments summation by X.

type Summation3 added in v0.1.14

type Summation3[T1 labelContraint, T2 labelContraint, T3 labelContraint] struct {
	// contains filtered or unexported fields
}

Summation3 is a incremental int64 summation type with 3 metric label.

func NewSummation3 added in v0.1.14

func NewSummation3[T1, T2, T3 labelContraint](name string, cfg MetricConfig) Summation3[T1, T2, T3]

NewSummation3 creates a new summation metric with 3 labels.

func (*Summation3[T1, T2, T3]) Inc added in v0.1.14

func (c *Summation3[T1, T2, T3]) Inc(v1 T1, v2 T2, v3 T3)

Inc increments summation by 1.

func (*Summation3[T1, T2, T3]) IncBy added in v0.1.14

func (c *Summation3[T1, T2, T3]) IncBy(v1 T1, v2 T2, v3 T3, by int64)

IncBy increments summation by X.

type Summation4 added in v0.1.14

type Summation4[T1 labelContraint, T2 labelContraint, T3 labelContraint, T4 labelContraint] struct {
	// contains filtered or unexported fields
}

Summation4 is a incremental int64 summation type with 4 metric label.

func NewSummation4 added in v0.1.14

func NewSummation4[T1, T2 labelContraint,
	T3, T4 labelContraint](name string, cfg MetricConfig,
) Summation4[T1, T2, T3, T4]

NewSummation4 creates a new summation metric with 4 labels.

func (*Summation4[T1, T2, T3, T4]) Inc added in v0.1.14

func (c *Summation4[T1, T2, T3, T4]) Inc(v1 T1, v2 T2, v3 T3, v4 T4)

Inc increments summation by 1.

func (*Summation4[T1, T2, T3, T4]) IncBy added in v0.1.14

func (c *Summation4[T1, T2, T3, T4]) IncBy(v1 T1, v2 T2, v3 T3, v4 T4, by int64)

IncBy increments summation by X.

Directories

Path Synopsis
Package main is an example of application stats collection
Package main is an example of application stats collection
Package internal holds the global state for Statz
Package internal holds the global state for Statz
Package units contains unit definitions for statz
Package units contains unit definitions for statz

Jump to

Keyboard shortcuts

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