metrics

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reset

func Reset()

Reset replaces the global collector with a fresh instance. For testing.

Types

type ACMEMetrics

type ACMEMetrics struct {
	ChallengesCreated atomic.Int64
	ChallengesDeleted atomic.Int64
	ChallengesExpired atomic.Int64
	DNSSetFailed      atomic.Int64
}

type ACMESnapshot

type ACMESnapshot struct {
	ChallengesCreated int64 `json:"challenges_created"`
	ChallengesDeleted int64 `json:"challenges_deleted"`
	ChallengesExpired int64 `json:"challenges_expired"`
	DNSSetFailed      int64 `json:"dns_set_failed"`
}

type CensusMetrics

type CensusMetrics struct {
	RunsCompleted   atomic.Int64
	RunsFailed      atomic.Int64
	LastCompletedAt atomic.Int64 // unix seconds
	LastDurationMs  atomic.Int64
}

type CensusSnapshot

type CensusSnapshot struct {
	RunsCompleted   int64 `json:"runs_completed"`
	RunsFailed      int64 `json:"runs_failed"`
	LastCompletedAt int64 `json:"last_completed_unix"`
	LastDurationMs  int64 `json:"last_duration_ms"`
}

type Collector

type Collector struct {
	StartedAt time.Time

	HTTP      HTTPMetrics
	RateLimit RateLimitMetrics
	Enroll    EnrollMetrics
	Nonce     NonceMetrics
	DNS       DNSMetrics
	ACME      ACMEMetrics
	LastSeen  LastSeenMetrics
	Census    CensusMetrics
	Nexus     NexusMetrics
	Recovery  RecoveryMetrics
}

Collector holds all operational metrics as atomic counters. Counters are monotonic from process start and reset on restart.

func Get

func Get() *Collector

Get returns the global metrics collector.

func NewCollector

func NewCollector() *Collector

NewCollector creates a fresh collector with StartedAt set to now.

func (*Collector) Snapshot

func (c *Collector) Snapshot() Snapshot

Snapshot returns a JSON-serializable copy of all current counter values.

type DNSMetrics

type DNSMetrics struct {
	UDPQueries atomic.Int64
	TCPQueries atomic.Int64
	UDPDropped atomic.Int64
	TCPDropped atomic.Int64
	Errors     atomic.Int64
}

type DNSSnapshot

type DNSSnapshot struct {
	UDPQueries int64 `json:"udp_queries"`
	TCPQueries int64 `json:"tcp_queries"`
	UDPDropped int64 `json:"udp_dropped"`
	TCPDropped int64 `json:"tcp_dropped"`
	Errors     int64 `json:"errors"`
}

type EnrollMetrics

type EnrollMetrics struct {
	Phase1Started          atomic.Int64
	Phase1CapacityExceeded atomic.Int64
	Phase2Completed        atomic.Int64
	Phase2Failed           atomic.Int64
	Reenrolled             atomic.Int64
}

type EnrollSnapshot

type EnrollSnapshot struct {
	Phase1Started          int64 `json:"phase1_started"`
	Phase1CapacityExceeded int64 `json:"phase1_capacity_exceeded"`
	Phase2Completed        int64 `json:"phase2_completed"`
	Phase2Failed           int64 `json:"phase2_failed"`
	Reenrolled             int64 `json:"reenrolled"`
}

type HTTPMetrics

type HTTPMetrics struct {
	Requests2xx atomic.Int64
	Requests4xx atomic.Int64
	Requests429 atomic.Int64
	Requests5xx atomic.Int64
}

type HTTPSnapshot

type HTTPSnapshot struct {
	Requests2xx int64 `json:"requests_2xx"`
	Requests4xx int64 `json:"requests_4xx"`
	Requests429 int64 `json:"requests_429"`
	Requests5xx int64 `json:"requests_5xx"`
}

type LastSeenMetrics

type LastSeenMetrics struct {
	FlushSuccess   atomic.Int64
	FlushErrors    atomic.Int64
	EntriesDropped atomic.Int64
}

type LastSeenSnapshot

type LastSeenSnapshot struct {
	FlushSuccess   int64 `json:"flush_success"`
	FlushErrors    int64 `json:"flush_errors"`
	EntriesDropped int64 `json:"entries_dropped"`
}

type NexusMetrics

type NexusMetrics struct {
	Registered     atomic.Int64
	Reactivated    atomic.Int64
	MarkedInactive atomic.Int64
}

type NexusSnapshot

type NexusSnapshot struct {
	Registered     int64 `json:"registered"`
	Reactivated    int64 `json:"reactivated"`
	MarkedInactive int64 `json:"marked_inactive"`
}

type NonceMetrics

type NonceMetrics struct {
	CapacityRejected atomic.Int64
	ConsumeNotFound  atomic.Int64
}

type NonceSnapshot

type NonceSnapshot struct {
	CapacityRejected int64 `json:"capacity_rejected"`
	ConsumeNotFound  int64 `json:"consume_not_found"`
}

type RateLimitMetrics

type RateLimitMetrics struct {
	RejectedGlobal    atomic.Int64
	RejectedPerIP     atomic.Int64
	RejectedPerDevice atomic.Int64
}

type RateLimitSnapshot

type RateLimitSnapshot struct {
	RejectedGlobal    int64 `json:"rejected_global"`
	RejectedPerIP     int64 `json:"rejected_per_ip"`
	RejectedPerDevice int64 `json:"rejected_per_device"`
}

type RecoveryMetrics

type RecoveryMetrics struct {
	ClaimsSubmitted   atomic.Int64
	QuorumReached     atomic.Int64
	AccountsDissolved atomic.Int64
}

type RecoverySnapshot

type RecoverySnapshot struct {
	ClaimsSubmitted   int64 `json:"claims_submitted"`
	QuorumReached     int64 `json:"quorum_reached"`
	AccountsDissolved int64 `json:"accounts_dissolved"`
}

type Snapshot

type Snapshot struct {
	HTTP       HTTPSnapshot      `json:"http"`
	RateLimit  RateLimitSnapshot `json:"rate_limit"`
	Enrollment EnrollSnapshot    `json:"enrollment"`
	DNS        DNSSnapshot       `json:"dns"`
	ACME       ACMESnapshot      `json:"acme"`
	LastSeen   LastSeenSnapshot  `json:"last_seen"`
	Census     CensusSnapshot    `json:"census"`
	Nexus      NexusSnapshot     `json:"nexus"`
	Recovery   RecoverySnapshot  `json:"recovery"`
	Nonce      NonceSnapshot     `json:"nonce"`
}

Jump to

Keyboard shortcuts

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