statz

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 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 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.

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