metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metrics provides protocol metrics collection and export.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrafanaDashboard

func GrafanaDashboard() string

GrafanaDashboard returns a Grafana dashboard JSON template.

Types

type Collector

type Collector struct {
	DecodeTotal  Counter
	DecodeErrors Counter
	EncodeTotal  Counter
	DecodeLat    Histogram
	ProtoCount   map[string]*Counter
	// contains filtered or unexported fields
}

Collector collects protocol metrics.

func NewCollector

func NewCollector() *Collector

NewCollector creates a new metrics collector.

func (*Collector) PrometheusExport

func (c *Collector) PrometheusExport() string

PrometheusExport exports metrics in Prometheus text format.

func (*Collector) RecordDecode

func (c *Collector) RecordDecode(proto string, elapsed time.Duration, err error)

RecordDecode records a decode operation.

type Counter

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

Counter is a monotonically increasing counter.

func (*Counter) Add

func (c *Counter) Add(n int64)

func (*Counter) Inc

func (c *Counter) Inc()

func (*Counter) Value

func (c *Counter) Value() int64

type Histogram

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

Histogram tracks value distributions.

func (*Histogram) Count

func (h *Histogram) Count() int

func (*Histogram) Observe

func (h *Histogram) Observe(v float64)

Jump to

Keyboard shortcuts

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