metrics

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package metrics provides interfaces and a collector for Vault operational metrics. The interfaces are compatible with common metric libraries (Prometheus, etc.) and can be bridged to external systems via the MetricFactory.

Deprecated: vault never recorded through Collector, so its instruments always read zero. Pass a go-utils metrics sink with vault.WithMetrics (the Forge extension passes app.Metrics() for you) to get the metrics vault actually records. This package is kept so existing imports still build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	SecretAccessed Counter
	SecretSet      Counter
	SecretDeleted  Counter
	SecretRotated  Counter
	FlagEvaluated  Counter
	FlagEvalTime   Histogram
	ConfigRead     Counter
	ConfigWritten  Counter
	OverrideRead   Counter
	AuditRecorded  Counter
	Encrypted      Counter
	Decrypted      Counter
	SourceLatency  Histogram
}

Collector holds all Vault metric instruments.

func NewCollector

func NewCollector(f MetricFactory) *Collector

NewCollector creates a Collector using the given factory.

func NewNoopCollector

func NewNoopCollector() *Collector

NewNoopCollector creates a Collector with no-op metrics.

type Counter

type Counter interface {
	Inc()
	Add(float64)
}

Counter is a monotonically increasing counter.

type Histogram

type Histogram interface {
	Observe(float64)
}

Histogram observes a distribution of values.

type MetricFactory

type MetricFactory interface {
	Counter(name string) Counter
	Histogram(name string) Histogram
}

MetricFactory creates named metric instances.

type NoopFactory

type NoopFactory struct{}

NoopFactory creates no-op metric instances.

func (NoopFactory) Counter

func (NoopFactory) Counter(string) Counter

Counter returns a no-op counter.

func (NoopFactory) Histogram

func (NoopFactory) Histogram(string) Histogram

Histogram returns a no-op histogram.

Jump to

Keyboard shortcuts

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