metrics

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

Prometheus metrics (uses Victoria/Metrics)

Usage:

  1. At first, we need create a new instance of metrics.Meter (interface: metrics.Meter).
  2. The second step is passing the metrics.Metrics into the response/request middlewares.
  3. Thirdly, the request/response middlewares should be added into the target HTTP server.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meter

type Meter interface {
	SetHits(value uint64)
	SetMisses(value uint64)
	SetErrors(value uint64)
	SetTotal(value uint64)
	SetPanics(value uint64)
	SetProxiedNum(value uint64)
	SetRPS(value float64)
	SetCacheLength(count uint64)
	SetCacheMemory(bytes uint64)
}

Meter defines methods for recording application metrics.

type Metrics

type Metrics struct{}

Metrics implements Meter using VictoriaMetrics metrics.

func New

func New() *Metrics

New creates a new Metrics instance.

func (*Metrics) SetCacheLength

func (m *Metrics) SetCacheLength(count uint64)

func (*Metrics) SetCacheMemory

func (m *Metrics) SetCacheMemory(bytes uint64)

func (*Metrics) SetErrors added in v0.9.7

func (m *Metrics) SetErrors(value uint64)

func (*Metrics) SetHits added in v0.9.7

func (m *Metrics) SetHits(value uint64)

func (*Metrics) SetMisses added in v0.9.7

func (m *Metrics) SetMisses(value uint64)

func (*Metrics) SetPanics added in v1.0.1

func (m *Metrics) SetPanics(value uint64)

func (*Metrics) SetProxiedNum added in v1.0.1

func (m *Metrics) SetProxiedNum(value uint64)

func (*Metrics) SetRPS added in v0.9.7

func (m *Metrics) SetRPS(value float64)

func (*Metrics) SetTotal added in v1.2.0

func (m *Metrics) SetTotal(value uint64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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