metrics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

The metrics package provides support for tracking various metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adjust

func Adjust(name string, val int64)

func Varz

func Varz(w http.ResponseWriter, r *http.Request)

Types

type Counter

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

Counter provides a simple monotonically incrementing counter.

func NewCounter

func NewCounter(name string) *Counter

func (*Counter) Adjust

func (c *Counter) Adjust(val int64)

func (*Counter) Increment

func (c *Counter) Increment()

func (*Counter) Name

func (c *Counter) Name() string

func (*Counter) Reset

func (c *Counter) Reset()

func (*Counter) Value

func (c *Counter) Value() uint64

type Gauge

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

The Gauge type represents a non-negative integer, which may increase or decrease, but shall never exceed the maximum value.

func NewGauge

func NewGauge(name string) *Gauge

func (*Gauge) Adjust

func (g *Gauge) Adjust(val int64)

Adjust allows one to increase or decrease a metric.

func (*Gauge) Increment

func (g *Gauge) Increment()

func (*Gauge) Name

func (g *Gauge) Name() string

func (*Gauge) Reset

func (g *Gauge) Reset()

func (*Gauge) Value

func (g *Gauge) Value() uint64

type Metric

type Metric interface {
	// Adjust increments or decrements the metric value.
	Adjust(int64)

	// Increment increases the metric value by one.
	Increment()

	// Name returns the varz name.
	Name() string

	// Reset the metric.
	Reset()

	// Value returns the current metric value.
	Value() uint64
}

Jump to

Keyboard shortcuts

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