metrics

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MgmtCertCollector added in v1.1.0

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

MgmtCertCollector exposes device-scoped metrics for management certificate handling. It matches the ManagementCertMetricsCallback signature used by the certmanager middleware.

func NewMgmtCertCollector added in v1.1.0

func NewMgmtCertCollector(l *log.PrefixLogger) *MgmtCertCollector

func (*MgmtCertCollector) Collect added in v1.1.0

func (c *MgmtCertCollector) Collect(ch chan<- prometheus.Metric)

func (*MgmtCertCollector) Describe added in v1.1.0

func (c *MgmtCertCollector) Describe(ch chan<- *prometheus.Desc)

func (*MgmtCertCollector) Observe added in v1.1.0

func (c *MgmtCertCollector) Observe(kind mgmtcertcommon.ManagementCertEventKind, cert *x509.Certificate, durationSeconds float64, err error)

Observe records a single management certificate event.

Rules:

	kind == current:
	- MUST set loaded=1 and not_after if cert != nil
	- MUST set loaded=0 and not_after=0 if cert == nil
	- MUST NOT create attempts/duration

	kind == renewal:
	- attempts + duration
	- update loaded/not_after ONLY on success with cert != nil (we do not clear state on failure)

	Result mapping (renewal only):
  	- err == nil                               → success
  	- ErrProvisionNotReady                     → pending
  	- any other error                          → failure

type RPCCollector

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

func NewRPCCollector

func NewRPCCollector(l *log.PrefixLogger) *RPCCollector

NewRPCCollector constructs a metrics collector dedicated to RPC latency. It exposes a fixed set of per-operation histograms (<op>_duration_seconds) labeled by result=("success"|"error"). The returned collector provides Observe(operation, seconds, err) to plug directly into the agent’s RPC timing callback.

func (*RPCCollector) Collect

func (c *RPCCollector) Collect(ch chan<- prometheus.Metric)

func (*RPCCollector) Describe

func (c *RPCCollector) Describe(ch chan<- *prometheus.Desc)

func (*RPCCollector) Observe

func (c *RPCCollector) Observe(operation string, seconds float64, err error)

Observe is the drop-in hook for the agent’s RPC timing callback. It matches the callback signature (operation, seconds, err) and records latency under <operation>_duration_seconds with result="success|error".

Jump to

Keyboard shortcuts

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