vars

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 233

Documentation

Index

Constants

View Source
const (

	// Dropped indicates we dropped the query before any handling. It has no closing dot, so it can not be a valid zone.
	Dropped = "dropped"
)

Variables

View Source
var (
	RequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "requests_total",
		Help:      "Counter of DNS requests made per zone, protocol and family.",
	}, []string{"server", "zone", "view", "proto", "family", "type"})

	RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace:                   plugin.Namespace,
		Subsystem:                   subsystem,
		Name:                        "request_duration_seconds",
		Buckets:                     plugin.TimeBuckets,
		NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
		Help:                        "Histogram of the time (in seconds) each request took per zone.",
	}, []string{"server", "zone", "view"})

	RequestSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace:                   plugin.Namespace,
		Subsystem:                   subsystem,
		Name:                        "request_size_bytes",
		Help:                        "Size of the EDNS0 UDP buffer in bytes (64K for TCP) per zone and protocol.",
		Buckets:                     []float64{0, 100, 200, 300, 400, 511, 1023, 2047, 4095, 8291, 16e3, 32e3, 48e3, 64e3},
		NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
	}, []string{"server", "zone", "view", "proto"})

	RequestDo = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "do_requests_total",
		Help:      "Counter of DNS requests with DO bit set per zone.",
	}, []string{"server", "zone", "view"})

	ResponseSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace:                   plugin.Namespace,
		Subsystem:                   subsystem,
		Name:                        "response_size_bytes",
		Help:                        "Size of the returned response in bytes.",
		Buckets:                     []float64{0, 100, 200, 300, 400, 511, 1023, 2047, 4095, 8291, 16e3, 32e3, 48e3, 64e3},
		NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
	}, []string{"server", "zone", "view", "proto"})

	ResponseRcode = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "responses_total",
		Help:      "Counter of response status codes.",
	}, []string{"server", "zone", "view", "rcode", "plugin"})

	Panic = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Name:      "panics_total",
		Help:      "A metrics that counts the number of panics.",
	})

	PluginEnabled = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: plugin.Namespace,
		Name:      "plugin_enabled",
		Help:      "A metric that indicates whether a plugin is enabled on per server and zone basis.",
	}, []string{"server", "zone", "view", "name"})

	HTTPSResponsesCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "https_responses_total",
		Help:      "Counter of DoH responses per server and http status code.",
	}, []string{"server", "status"})

	HTTPS3ResponsesCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "https3_responses_total",
		Help:      "Counter of DoH3 responses per server and http status code.",
	}, []string{"server", "status"})

	QUICResponsesCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: subsystem,
		Name:      "quic_responses_total",
		Help:      "Counter of DoQ responses per server and QUIC application code.",
	}, []string{"server", "status"})
)

Request* and Response* are the prometheus counters and gauges we are using for exporting metrics.

Functions

func Report

func Report(server string, req request.Request, zone, view, rcode, plugin string,
	size int, start time.Time, opts ...ReportOption)

Report reports the metrics data associated with request. This function is exported because it is also called from core/dnsserver to report requests hitting the server that should not be handled and are thus not sent down the plugin chain.

Types

type ReportOption added in v1.12.2

type ReportOption func(*ReportOptions)

ReportOption defines a function that modifies ReportOptions

func WithOriginalReqSize added in v1.12.2

func WithOriginalReqSize(size int) ReportOption

WithOriginalReqSize returns an option to set the original request size

type ReportOptions added in v1.12.2

type ReportOptions struct {
	OriginalReqSize int
}

ReportOptions is a struct that contains available options for the Report function.

Jump to

Keyboard shortcuts

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