Documentation
¶
Index ¶
- type FallbackEvent
- type FallbackEventRing
- type Metrics
- func (m *Metrics) AddCacheEvictions(reason string, count int)
- func (m *Metrics) EDECounts() map[uint16]int64
- func (m *Metrics) FallbackEventRing() *FallbackEventRing
- func (m *Metrics) IncBlockedQueries()
- func (m *Metrics) IncCacheEvictions(reason string)
- func (m *Metrics) IncCacheHits()
- func (m *Metrics) IncCacheMisses()
- func (m *Metrics) IncDNSSECBogus()
- func (m *Metrics) IncDNSSECInsecure()
- func (m *Metrics) IncDNSSECSecure()
- func (m *Metrics) IncEDE(code uint16)
- func (m *Metrics) IncFailureCacheHits()
- func (m *Metrics) IncFailureCacheMisses()
- func (m *Metrics) IncFallbackQueries()
- func (m *Metrics) IncFallbackRecoveries()
- func (m *Metrics) IncNSEC3AggressiveSynthND()
- func (m *Metrics) IncNSEC3AggressiveSynthNX()
- func (m *Metrics) IncNSECAggressiveSynthNX()
- func (m *Metrics) IncNSECAggressiveSynthNoData()
- func (m *Metrics) IncOutboundBadCookieRetries()
- func (m *Metrics) IncPrefetchDrops()
- func (m *Metrics) IncQueries(qtype string)
- func (m *Metrics) IncRateLimited()
- func (m *Metrics) IncResponses(rcode string)
- func (m *Metrics) IncServerCookieCacheHits()
- func (m *Metrics) IncServerCookieCacheMisses()
- func (m *Metrics) IncStaleWhileRefreshTriggers()
- func (m *Metrics) IncUDPWorkerDrops()
- func (m *Metrics) IncUpstreamErrors()
- func (m *Metrics) IncUpstreamQueries()
- func (m *Metrics) ObserveQueryDuration(d time.Duration)
- func (m *Metrics) PrefetchDrops() int64
- func (m *Metrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Metrics) SetDNSSECRolloverValidates(n int64)
- func (m *Metrics) Snapshot() MetricsSnapshot
- func (m *Metrics) StartTime() time.Time
- func (m *Metrics) UDPWorkerDrops() int64
- func (m *Metrics) WriteMetrics(w io.Writer)
- type MetricsSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FallbackEvent ¶ added in v0.6.2
type FallbackEvent struct {
Timestamp time.Time
QueryName string
QType uint16
QClass uint16
// PrimaryFailureReason describes why the primary resolver failed:
// e.g. "SERVFAIL", "connection refused", "timeout", "nil result".
PrimaryFailureReason string
// ResolverAddr is the fallback resolver address that handled this query.
ResolverAddr string
Recovered bool
RCODE uint8
Error string
}
FallbackEvent records a single fallback query attempt.
type FallbackEventRing ¶ added in v0.6.2
type FallbackEventRing struct {
// contains filtered or unexported fields
}
FallbackEventRing is a thread-safe, bounded ring buffer of FallbackEvents. Pre-allocated [100]FallbackEvent array — no heap growth after init.
func NewFallbackEventRing ¶ added in v0.6.2
func NewFallbackEventRing() *FallbackEventRing
NewFallbackEventRing creates a new FallbackEventRing.
func (*FallbackEventRing) Add ¶ added in v0.6.2
func (r *FallbackEventRing) Add(e FallbackEvent)
Add appends an event to the ring buffer, overwriting the oldest when full.
func (*FallbackEventRing) Events ¶ added in v0.6.2
func (r *FallbackEventRing) Events() []FallbackEvent
Events returns all events in oldest-to-newest order.
type Metrics ¶
type Metrics struct {
// RecordFallbackFunc is an optional callback invoked each time a fallback
// query fires (query=1) or recovers (recovery=1). Set by the web package
// to route fallback events into the time-series aggregator.
RecordFallbackFunc func(query, recovery int64)
// contains filtered or unexported fields
}
Metrics holds all application metrics using lock-free atomic counters.
func (*Metrics) AddCacheEvictions ¶
func (*Metrics) EDECounts ¶ added in v0.7.13
EDECounts returns a snapshot of every EDE code observed so far mapped to its emission count. Snapshot copy — callers may iterate freely without holding any lock from this package.
func (*Metrics) FallbackEventRing ¶ added in v0.6.2
func (m *Metrics) FallbackEventRing() *FallbackEventRing
FallbackEventRing returns the fallback event ring buffer.
func (*Metrics) IncBlockedQueries ¶
func (m *Metrics) IncBlockedQueries()
func (*Metrics) IncCacheEvictions ¶
func (*Metrics) IncCacheHits ¶
func (m *Metrics) IncCacheHits()
func (*Metrics) IncCacheMisses ¶
func (m *Metrics) IncCacheMisses()
func (*Metrics) IncDNSSECBogus ¶
func (m *Metrics) IncDNSSECBogus()
func (*Metrics) IncDNSSECInsecure ¶
func (m *Metrics) IncDNSSECInsecure()
func (*Metrics) IncDNSSECSecure ¶
func (m *Metrics) IncDNSSECSecure()
func (*Metrics) IncEDE ¶ added in v0.7.13
IncEDE counts one emission of EDE info-code `code` (RFC 8914 §4). The map allocates a counter the first time a code is seen — for the fixed RFC-8914 code set this is bounded; the lazy approach also lets us absorb future IANA-assigned codes without code changes.
func (*Metrics) IncFailureCacheHits ¶ added in v0.6.24
func (m *Metrics) IncFailureCacheHits()
Y34 — failure cache & server-cookie cache.
func (*Metrics) IncFailureCacheMisses ¶ added in v0.6.24
func (m *Metrics) IncFailureCacheMisses()
func (*Metrics) IncFallbackQueries ¶ added in v0.5.3
func (m *Metrics) IncFallbackQueries()
func (*Metrics) IncFallbackRecoveries ¶ added in v0.5.3
func (m *Metrics) IncFallbackRecoveries()
func (*Metrics) IncNSEC3AggressiveSynthND ¶ added in v0.6.24
func (m *Metrics) IncNSEC3AggressiveSynthND()
func (*Metrics) IncNSEC3AggressiveSynthNX ¶ added in v0.6.24
func (m *Metrics) IncNSEC3AggressiveSynthNX()
func (*Metrics) IncNSECAggressiveSynthNX ¶ added in v0.6.24
func (m *Metrics) IncNSECAggressiveSynthNX()
Y35 — RFC 8198 aggressive-use synthesis counters.
func (*Metrics) IncNSECAggressiveSynthNoData ¶ added in v0.6.24
func (m *Metrics) IncNSECAggressiveSynthNoData()
func (*Metrics) IncOutboundBadCookieRetries ¶ added in v0.6.24
func (m *Metrics) IncOutboundBadCookieRetries()
Y36 — cookie retry & stale-while-refresh.
func (*Metrics) IncPrefetchDrops ¶ added in v0.8.32
func (m *Metrics) IncPrefetchDrops()
IncPrefetchDrops counts one skipped prefetch/stale-refresh under concurrency cap.
func (*Metrics) IncQueries ¶
func (*Metrics) IncRateLimited ¶
func (m *Metrics) IncRateLimited()
func (*Metrics) IncResponses ¶
func (*Metrics) IncServerCookieCacheHits ¶ added in v0.6.24
func (m *Metrics) IncServerCookieCacheHits()
func (*Metrics) IncServerCookieCacheMisses ¶ added in v0.6.24
func (m *Metrics) IncServerCookieCacheMisses()
func (*Metrics) IncStaleWhileRefreshTriggers ¶ added in v0.6.24
func (m *Metrics) IncStaleWhileRefreshTriggers()
func (*Metrics) IncUDPWorkerDrops ¶ added in v0.8.32
func (m *Metrics) IncUDPWorkerDrops()
IncUDPWorkerDrops counts one UDP datagram dropped at the admit gate.
func (*Metrics) IncUpstreamErrors ¶
func (m *Metrics) IncUpstreamErrors()
func (*Metrics) IncUpstreamQueries ¶
func (m *Metrics) IncUpstreamQueries()
func (*Metrics) ObserveQueryDuration ¶
func (*Metrics) PrefetchDrops ¶ added in v0.8.32
PrefetchDrops returns the cumulative prefetch concurrency-cap drop count.
func (*Metrics) ServeHTTP ¶
func (m *Metrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for the /metrics endpoint.
Format: Prometheus exposition v0.0.4 (the wire format every scraper understands; OpenMetrics is a superset and accepts this too). Every metric family is preceded by `# HELP` (one-line description used by Grafana auto-docs and `promtool check metrics`) and `# TYPE` (counter / gauge / histogram — required by `rate()` family semantics in PromQL). Skipping HELP/TYPE makes Labyrinth parse but silently downgrade the scraper's metadata, and `promtool check metrics` flags every series as missing metadata.
func (*Metrics) SetDNSSECRolloverValidates ¶ added in v0.8.32
SetDNSSECRolloverValidates sets the DNSSEC rollover validation counter from the validator's cumulative count. Called periodically by the resolver to expose zone algorithm rollover activity.
func (*Metrics) Snapshot ¶
func (m *Metrics) Snapshot() MetricsSnapshot
Snapshot returns a point-in-time snapshot of all metrics.
func (*Metrics) UDPWorkerDrops ¶ added in v0.8.32
UDPWorkerDrops returns the cumulative UDP admit-gate drop count.
func (*Metrics) WriteMetrics ¶
WriteMetrics writes all metrics in Prometheus text format.
type MetricsSnapshot ¶
type MetricsSnapshot struct {
QueriesByType map[string]int64
ResponsesByRCode map[string]int64
CacheHits int64
CacheMisses int64
CacheEvictions int64
UpstreamQueries int64
UpstreamErrors int64
RateLimited int64
UptimeSeconds float64
Goroutines int
QueryDurationCount int64
DNSSECSecure int64
DNSSECInsecure int64
DNSSECBogus int64
BlockedQueries int64
FallbackQueries int64
FallbackRecoveries int64
// Y34/Y35/Y36 — observability counters surfaced via /api/stats.
FailureCacheHits int64
FailureCacheMisses int64
ServerCookieCacheHits int64
ServerCookieCacheMisses int64
NSECAggressiveSynthNX int64
NSECAggressiveSynthNoData int64
NSEC3AggressiveSynthNX int64
NSEC3AggressiveSynthND int64
OutboundBadCookieRetries int64
StaleWhileRefreshTriggers int64
}
MetricsSnapshot holds a point-in-time snapshot of all metrics.