Documentation
¶
Index ¶
- type FallbackEvent
- type FallbackEventRing
- type Metrics
- func (m *Metrics) AddCacheEvictions(reason string, count int)
- 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) IncFallbackQueries()
- func (m *Metrics) IncFallbackRecoveries()
- func (m *Metrics) IncQueries(qtype string)
- func (m *Metrics) IncRateLimited()
- func (m *Metrics) IncResponses(rcode string)
- func (m *Metrics) IncUpstreamErrors()
- func (m *Metrics) IncUpstreamQueries()
- func (m *Metrics) ObserveQueryDuration(d time.Duration)
- func (m *Metrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Metrics) Snapshot() MetricsSnapshot
- func (m *Metrics) StartTime() time.Time
- 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) 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) IncFallbackQueries ¶ added in v0.5.3
func (m *Metrics) IncFallbackQueries()
func (*Metrics) IncFallbackRecoveries ¶ added in v0.5.3
func (m *Metrics) IncFallbackRecoveries()
func (*Metrics) IncQueries ¶
func (*Metrics) IncRateLimited ¶
func (m *Metrics) IncRateLimited()
func (*Metrics) IncResponses ¶
func (*Metrics) IncUpstreamErrors ¶
func (m *Metrics) IncUpstreamErrors()
func (*Metrics) IncUpstreamQueries ¶
func (m *Metrics) IncUpstreamQueries()
func (*Metrics) ObserveQueryDuration ¶
func (*Metrics) ServeHTTP ¶
func (m *Metrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for the /metrics endpoint.
func (*Metrics) Snapshot ¶
func (m *Metrics) Snapshot() MetricsSnapshot
Snapshot returns a point-in-time snapshot of all metrics.
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
}
MetricsSnapshot holds a point-in-time snapshot of all metrics.