Documentation
¶
Overview ¶
Package metrics provides Prometheus metrics helpers for the filterlist plugin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
AllowlistChecks prometheus.Counter
DenylistChecks prometheus.Counter
AllowlistHits prometheus.Counter
DenylistHits prometheus.Counter
CompileErrors prometheus.Counter
CompileDuration prometheus.Histogram
AllowlistRules prometheus.Gauge
DenylistRules prometheus.Gauge
LastCompileTimestamp prometheus.Gauge
LastCompileDurationSeconds prometheus.Gauge
MatchDuration *prometheus.SummaryVec
}
Registry groups the Prometheus collectors used by filterlist.
Each field exposes one metric family for query decisions, compile results, or current ruleset size. Callers usually create one Registry per process or per Prometheus registerer and then share it across handler instances.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a filterlist metric set on prometheus.DefaultRegisterer.
The returned Registry reuses already-registered collectors when another filterlist instance has already published the same metric names. Use this in CoreDNS plugin setup paths where multiple server blocks may instantiate the plugin within the same process.
func NewRegistryWith ¶
func NewRegistryWith(reg prometheus.Registerer) *Registry
NewRegistryWith creates a filterlist metric set on reg.
The reg parameter selects the Prometheus registerer that should own the metrics. When reg already contains collectors with the same metric descriptors, the existing collectors are reused instead of causing a panic. This keeps repeated setup calls safe while preserving shared metric series.