metrics

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package metrics contains definitions of most of the prometheus metrics that we use in AdGuard DNS.

TODO(ameshkov): consider not using promauto.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ProfilesSyncFullTimeouts is a gauge with the total number of timeout
	// errors occurred during full profiles sync.
	ProfilesSyncFullTimeouts = profilesSyncTimeouts.With(prometheus.Labels{
		"is_full_sync": "1",
	})

	// ProfilesSyncPartTimeouts is a gauge with the total number of timeout
	// errors occurred during partial profiles sync.
	ProfilesSyncPartTimeouts = profilesSyncTimeouts.With(prometheus.Labels{
		"is_full_sync": "0",
	})
)
View Source
var (
	// BillStatBufSize is a gauge with the total count of records in the local
	// billing statistics database.
	BillStatBufSize = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "buf_size",
		Namespace: namespace,
		Subsystem: subsystemBillStat,
		Help:      "Count of records in the local billstat DB.",
	})

	// BillStatUploadStatus is a gauge with the status of the last billing
	// statistics upload.
	BillStatUploadStatus = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "bill_stat_upload_status",
		Namespace: namespace,
		Subsystem: subsystemBillStat,
		Help:      "Status of the last billstat upload.",
	})

	// BillStatUploadTimestamp is a gauge with the timestamp of the last billing
	// statistics upload.
	BillStatUploadTimestamp = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "bill_stat_upload_timestamp",
		Namespace: namespace,
		Subsystem: subsystemBillStat,
		Help:      "Time when the billing statistics were uploaded last time.",
	})

	// BillStatUploadDuration is a histogram with the duration of the billing
	// statistics upload.
	BillStatUploadDuration = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:      "bill_stat_upload_duration",
		Namespace: namespace,
		Subsystem: subsystemBillStat,
		Help:      "Time elapsed on uploading billing statistics to the backend.",
		Buckets:   []float64{0.001, 0.01, 0.1, 1, 5, 10, 30, 60, 120},
	})
)
View Source
var (

	// BindToDeviceUnknownTCPRequestsTotal is the total counter of DNS requests
	// over TCP to unknown local addresses.
	BindToDeviceUnknownTCPRequestsTotal = bindToDeviceUnknownRequestsTotal.With(prometheus.Labels{
		"proto": "tcp",
	})

	// BindToDeviceUnknownUDPRequestsTotal is the total counter of DNS requests
	// over UDP to unknown local addresses.
	BindToDeviceUnknownUDPRequestsTotal = bindToDeviceUnknownRequestsTotal.With(prometheus.Labels{
		"proto": "udp",
	})
)
View Source
var (
	// BindToDeviceTCPConnsChanSize is a gauge with the current number of TCP
	// connections in the buffer of the channel by each subnet.
	BindToDeviceTCPConnsChanSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "tcp_conns_chan_size",
		Namespace: namespace,
		Subsystem: subsystemBindToDevice,
		Help:      "The current number of TCP connections in the channel.",
	}, []string{"subnet"})

	// BindToDeviceUDPSessionsChanSize is a gauge with the current number of UDP
	// sessions in the buffer of the channel by each subnet.
	BindToDeviceUDPSessionsChanSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "udp_sessions_chan_size",
		Namespace: namespace,
		Subsystem: subsystemBindToDevice,
		Help:      "The current number of UDP sessions in the channel.",
	}, []string{"subnet"})

	// BindToDeviceUDPWriteRequestsChanSize is a gauge with the current number
	// of UDP write requests in the buffer of the channel by each subnet.
	BindToDeviceUDPWriteRequestsChanSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "udp_write_requests_chan_size",
		Namespace: namespace,
		Subsystem: subsystemBindToDevice,
		Help:      "The current number of UDP write requests in the channel.",
	}, []string{"subnet"})
)
View Source
var (
	// ConsulAllowlistSize is a gauge with the number of records in the
	// ratelimit allowlist loaded from Consul.
	ConsulAllowlistSize = promauto.NewGauge(prometheus.GaugeOpts{
		Subsystem: subsystemConsul,
		Namespace: namespace,
		Name:      "allowlist_size",
		Help:      "Size of the ratelimit allowlist loaded from Consul.",
	})
	// ConsulAllowlistUpdateStatus is a gauge with the status of the last
	// ratelimit allowlist update.  1 means success.
	ConsulAllowlistUpdateStatus = promauto.NewGauge(prometheus.GaugeOpts{
		Subsystem: subsystemConsul,
		Namespace: namespace,
		Name:      "allowlist_update_status",
		Help:      "Status of the last ratelimit allowlist update. 1 means success.",
	})
	// ConsulAllowlistUpdateTime is a gauge with the timestamp of the last
	// ratelimit allowlist update.
	ConsulAllowlistUpdateTime = promauto.NewGauge(prometheus.GaugeOpts{
		Subsystem: subsystemConsul,
		Namespace: namespace,
		Name:      "allowlist_update_timestamp",
		Help:      "Timestamp of the last ratelimit allowlist update.",
	})
)
View Source
var (
	// DNSDBBufferSize is a gauge with the total count of records in the
	// in-memory temporary buffer.
	DNSDBBufferSize = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "buffer_size",
		Namespace: namespace,
		Subsystem: subsystemDNSDB,
		Help:      "Count of records in the in-memory buffer.",
	})

	// DNSDBRotateTime is a gauge with the time when the DNSDB was rotated.
	DNSDBRotateTime = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "rotate_time",
		Namespace: namespace,
		Subsystem: subsystemDNSDB,
		Help:      "Last time when the database was rotated.",
	})

	// DNSDBSaveDuration is a histogram with the time elapsed on rotating the
	// buffer for sending over HTTP.
	DNSDBSaveDuration = promauto.NewHistogram(prometheus.HistogramOpts{
		Name:      "save_duration",
		Namespace: namespace,
		Subsystem: subsystemDNSDB,
		Help:      "Time elapsed on rotating the buffer for sending over HTTP.",
	})
)
View Source
var (

	// DNSSvcDDRRequestsTotal is a counter with total number of requests for
	// Discovery of Designated Resolvers.
	DNSSvcDDRRequestsTotal = specialRequestsTotal.With(prometheus.Labels{
		"kind": "ddr",
	})

	// DNSSvcBadResolverARPA is a counter with total number of requests for
	// malformed resolver.arpa queries.
	DNSSvcBadResolverARPA = specialRequestsTotal.With(prometheus.Labels{
		"kind": "bad_resolver_arpa",
	})

	// DNSSvcFirefoxRequestsTotal is a counter with total number of requests for
	// the domain name that Firefox uses to check if it should use its own
	// DNS-over-HTTPS settings.
	DNSSvcFirefoxRequestsTotal = specialRequestsTotal.With(prometheus.Labels{
		"kind": "firefox",
	})

	// DNSSvcApplePrivateRelayRequestsTotal is a counter with total number of
	// requests for the domain name that Apple devices use to check if Apple
	// Private Relay can be enabled.
	DNSSvcApplePrivateRelayRequestsTotal = specialRequestsTotal.With(prometheus.Labels{
		"kind": "apple_private_relay",
	})
)
View Source
var (

	// ECSNoSupportCacheSize is the gauge with the total number of items in
	// the cache for domain names that do not support ECS.
	ECSNoSupportCacheSize = ecsCacheSize.With(prometheus.Labels{
		"supports": "no",
	})

	// ECSHasSupportCacheSize is the gauge with the total number of items in
	// the cache for domain names that support ECS.
	ECSHasSupportCacheSize = ecsCacheSize.With(prometheus.Labels{
		"supports": "yes",
	})
)

Cache size metrics.

View Source
var (

	// ECSCacheLookupTotalHits is a counter with the total number of ECS cache
	// hits.
	ECSCacheLookupTotalHits = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "1",
		"supports": "all",
	})

	// ECSCacheLookupHasSupportHits is a counter with the number of ECS cache
	// hits for hosts that support ECS.
	ECSCacheLookupHasSupportHits = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "1",
		"supports": "yes",
	})

	// ECSCacheLookupNoSupportHits is a counter with the number of ECS cache
	// hits for hosts that don't support ECS.
	ECSCacheLookupNoSupportHits = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "1",
		"supports": "no",
	})

	// ECSCacheLookupTotalMisses is a counter with the total number of ECS cache
	// misses.
	ECSCacheLookupTotalMisses = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "0",
		"supports": "all",
	})

	// ECSCacheLookupHasSupportMisses is a counter with the number of ECS cache
	// misses for hosts that support ECS.
	ECSCacheLookupHasSupportMisses = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "0",
		"supports": "yes",
	})

	// ECSCacheLookupNoSupportMisses is a counter with the number of ECS cache
	// misses for hosts that don't support ECS.
	ECSCacheLookupNoSupportMisses = ecsCacheLookups.With(prometheus.Labels{
		"hit":      "0",
		"supports": "no",
	})
)

Lookup metrics.

View Source
var (
	// FilterRulesTotal is a gauge with the number of rules loaded by each
	// filter.
	FilterRulesTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "rules_total",
		Subsystem: subsystemFilter,
		Namespace: namespace,
		Help:      "The number of rules loaded by filters.",
	}, []string{"filter"})

	// FilterUpdatedTime is a gauge with the last time when the filter was last
	// time updated.
	FilterUpdatedTime = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "updated_time",
		Subsystem: subsystemFilter,
		Namespace: namespace,
		Help:      "Time when the filter was last time updated.",
	}, []string{"filter"})

	// FilterUpdatedStatus is a gauge with status of the last filter update.
	// "0" means error, "1" means success.
	FilterUpdatedStatus = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "update_status",
		Subsystem: subsystemFilter,
		Namespace: namespace,
		Help:      "Status of the filter update. 1 means success.",
	}, []string{"filter"})

	// FilterCustomCacheLookupsHits is a counter with the total number of the
	// custom filter cache hits.
	FilterCustomCacheLookupsHits = filterCustomCacheLookups.With(prometheus.Labels{"hit": "1"})

	// FilterCustomCacheLookupsMisses is a counter with the total number of the
	// custom filter cache misses.
	FilterCustomCacheLookupsMisses = filterCustomCacheLookups.With(prometheus.Labels{"hit": "0"})
)
View Source
var (

	// HashPrefixFilterSafeBrowsingCacheSize is the gauge with the total number
	// of items in the cache for domain names for safe browsing filter.
	HashPrefixFilterSafeBrowsingCacheSize = hashPrefixFilterCacheSize.With(prometheus.Labels{
		"filter": "safe_browsing",
	})

	// HashPrefixFilterAdultBlockingCacheSize is the gauge with the total number
	// of items in the cache for domain names for adult blocking filter.
	HashPrefixFilterAdultBlockingCacheSize = hashPrefixFilterCacheSize.With(prometheus.Labels{
		"filter": "adult_blocking",
	})

	// HashPrefixFilterNewRegDomainsCacheSize is the gauge with the total number
	// of items in the cache for domain names for safe browsing newly registered
	// domains filter.
	HashPrefixFilterNewRegDomainsCacheSize = hashPrefixFilterCacheSize.With(prometheus.Labels{
		"filter": "newly_registered_domains",
	})

	// HashPrefixFilterCacheSafeBrowsingHits is a counter with the total number
	// of safe browsing filter cache hits.
	HashPrefixFilterCacheSafeBrowsingHits = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "1",
		"filter": "safe_browsing",
	})

	// HashPrefixFilterCacheSafeBrowsingMisses is a counter with the total number
	// of safe browsing filter cache misses.
	HashPrefixFilterCacheSafeBrowsingMisses = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "0",
		"filter": "safe_browsing",
	})

	// HashPrefixFilterCacheAdultBlockingHits is a counter with the total number
	// of adult blocking filter cache hits.
	HashPrefixFilterCacheAdultBlockingHits = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "1",
		"filter": "adult_blocking",
	})

	// HashPrefixFilterCacheAdultBlockingMisses is a counter with the total number
	// of adult blocking filter cache misses.
	HashPrefixFilterCacheAdultBlockingMisses = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "0",
		"filter": "adult_blocking",
	})

	// HashPrefixFilterCacheNewRegDomainsHits is a counter with the total number
	// of newly registered domains filter cache hits.
	HashPrefixFilterCacheNewRegDomainsHits = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "1",
		"filter": "newly_registered_domains",
	})

	// HashPrefixFilterCacheNewRegDomainsMisses is a counter with the total
	// number of newly registered domains filter cache misses.
	HashPrefixFilterCacheNewRegDomainsMisses = hashPrefixFilterCacheLookups.With(prometheus.Labels{
		"hit":    "0",
		"filter": "newly_registered_domains",
	})
)
View Source
var (
	// GeoIPUpdateTime is a gauge with the timestamp of the last GeoIP database
	// update.
	GeoIPUpdateTime = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "update_time",
		Subsystem: subsystemGeoIP,
		Namespace: namespace,
		Help:      "The time when the GeoIP was loaded last time.",
	}, []string{"path"})

	// GeoIPUpdateStatus is a gauge with the last GeoIP database update status.
	// 1 means success, 0 means an error occurred.
	GeoIPUpdateStatus = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "update_status",
		Subsystem: subsystemGeoIP,
		Namespace: namespace,
		Help:      "Status of the last GeoIP update. 1 is okay, 0 means that something went wrong.",
	}, []string{"path"})
)
View Source
var (

	// GeoIPCacheLookupsHits is a counter with the total number of the GeoIP IP
	// cache hits.
	GeoIPCacheLookupsHits = geoIPCacheLookups.With(prometheus.Labels{"hit": "1"})

	// GeoIPCacheLookupsMisses is a counter with the total number of the GeoIP
	// IP cache misses.
	GeoIPCacheLookupsMisses = geoIPCacheLookups.With(prometheus.Labels{"hit": "0"})
)
View Source
var (

	// GeoIPHostCacheLookupsHits is a counter with the total number of the GeoIP
	// hostname cache hits.
	GeoIPHostCacheLookupsHits = geoIPHostCacheLookups.With(prometheus.Labels{"hit": "1"})

	// GeoIPHostCacheLookupsMisses is a counter with the total number of the
	// GeoIP hostname cache misses.
	GeoIPHostCacheLookupsMisses = geoIPHostCacheLookups.With(prometheus.Labels{"hit": "0"})
)
View Source
var (
	// RuleStatCacheSize is a gauge with the count of recorded rule hits not
	// yet uploaded.
	RuleStatCacheSize = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "stats_cache_size",
		Namespace: namespace,
		Subsystem: subsystemRuleStat,
		Help:      "Count of recorded rule hits not yet dumped.",
	})
	// RuleStatUploadStatus is a gauge with the status of the last stats upload.
	RuleStatUploadStatus = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "stats_upload_status",
		Namespace: namespace,
		Subsystem: subsystemRuleStat,
		Help:      "Status of the last stats upload.",
	})
	// RuleStatUploadTimestamp is a gauge with the timestamp of the last stats
	// upload.
	RuleStatUploadTimestamp = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "stats_upload_timestamp",
		Namespace: namespace,
		Subsystem: subsystemRuleStat,
		Help:      "Time when stats were uploaded last time.",
	})
)
View Source
var (
	// TLSCertificateInfo is a gauge with the authentication algorithm of
	// the certificate.
	TLSCertificateInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "cert_info",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Authentication algorithm and other information about the certificate.",
	}, []string{"auth_algo", "subject"})

	// TLSCertificateNotAfter is a gauge with the time when the certificate
	// expires.
	TLSCertificateNotAfter = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name:      "cert_not_after",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Time when the certificate expires.",
	}, []string{"subject"})

	// TLSSessionTicketsRotateStatus is a gauge with the status of the last
	// tickets rotation.
	TLSSessionTicketsRotateStatus = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "session_tickets_rotate_status",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Status of the last tickets rotation.",
	})
	// TLSSessionTicketsRotateTime is a gauge with the time when the TLS session
	// tickets were rotated.
	TLSSessionTicketsRotateTime = promauto.NewGauge(prometheus.GaugeOpts{
		Name:      "session_tickets_rotate_time",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Time when the TLS session tickets were rotated.",
	})
	// TLSHandshakeAttemptsTotal is a counter with the total number of attempts
	// to establish a TLS connection.  "supported_protos" is a comma-separated
	// list of the protocols supported by the client.
	TLSHandshakeAttemptsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name:      "handshake_attempts_total",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Total count of TLS handshakes.",
	}, []string{
		"proto",
		"supported_protos",
		"tls_version",
	})
	// TLSHandshakeTotal is a counter with the total count of TLS handshakes.
	TLSHandshakeTotal = promauto.NewCounterVec(prometheus.CounterOpts{
		Name:      "handshake_total",
		Namespace: namespace,
		Subsystem: subsystemTLS,
		Help:      "Total count of TLS handshakes.",
	}, []string{
		"proto",
		"tls_version",
		"did_resume",
		"cipher_suite",
		"negotiated_proto",
		"server_name",
	})
)
View Source
var (

	// WebSvcError404RequestsTotal is a counter with total number of
	// requests with error 404.
	WebSvcError404RequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "error404",
	})

	// WebSvcError500RequestsTotal is a counter with total number of
	// requests with error 500.
	WebSvcError500RequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "error500",
	})

	// WebSvcStaticContentRequestsTotal is a counter with total number of
	// requests for static content.
	WebSvcStaticContentRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "static_content",
	})

	// WebSvcDNSCheckTestRequestsTotal is a counter with total number of
	// requests for dnscheck_test.
	WebSvcDNSCheckTestRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "dnscheck_test",
	})

	// WebSvcRobotsTxtRequestsTotal is a counter with total number of
	// requests for robots_txt.
	WebSvcRobotsTxtRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "robots_txt",
	})

	// WebSvcRootRedirectRequestsTotal is a counter with total number of
	// root redirected requests.
	WebSvcRootRedirectRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "root_redirect",
	})

	// WebSvcLinkedIPProxyRequestsTotal is a counter with total number of
	// requests with linked ip.
	WebSvcLinkedIPProxyRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "linkip",
	})

	// WebSvcAdultBlockingPageRequestsTotal is a counter with total number
	// of requests for adult blocking page.
	WebSvcAdultBlockingPageRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "adult_blocking_page",
	})

	// WebSvcSafeBrowsingPageRequestsTotal is a counter with total number
	// of requests for safe browsing page.
	WebSvcSafeBrowsingPageRequestsTotal = webSvcRequestsTotal.With(prometheus.Labels{
		"kind": "safe_browsing_page",
	})
)
View Source
var AccessBlockedForHostTotal = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "blocked_host_total",
	Namespace: namespace,
	Subsystem: subsystemAccess,
	Help:      "Total count of blocked host requests.",
})

AccessBlockedForHostTotal is a counter with the total count of requests blocked for request's host by global access manager.

View Source
var AccessBlockedForProfileTotal = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "profile_blocked_total",
	Namespace: namespace,
	Subsystem: subsystemAccess,
	Help:      "Total count of blocked profile requests.",
})

AccessBlockedForProfileTotal is a counter with the total count of requests blocked for all profiles by access manager.

View Source
var AccessBlockedForSubnetTotal = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "blocked_subnet_total",
	Namespace: namespace,
	Subsystem: subsystemAccess,
	Help:      "Total count of blocked subnet requests.",
})

AccessBlockedForSubnetTotal is a counter with the total count of requests blocked for client's subnet by global access manager.

View Source
var AccessProfileInitDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "profile_init_engine_duration_seconds",
	Namespace: namespace,
	Subsystem: subsystemAccess,
	Help:      "Time elapsed on profile access engine initialization.",
})

AccessProfileInitDuration is a histogram with the duration of a profile access internal engine initialization.

View Source
var ConnLimiterActiveStreamConns = promauto.NewGaugeVec(prometheus.GaugeOpts{
	Name:      "active_stream_conns",
	Namespace: namespace,
	Subsystem: subsystemConnLimiter,
	Help:      `The number of currently active stream-connections.`,
}, []string{"name", "proto", "addr"})

ConnLimiterActiveStreamConns is the gauge vector for the number of active stream-connections.

View Source
var ConnLimiterLimits = promauto.NewGaugeVec(prometheus.GaugeOpts{
	Name:      "limits",
	Namespace: namespace,
	Subsystem: subsystemConnLimiter,
	Help: `The current limits of the number of active stream-connections: ` +
		`kind="stop" for the stopping limit and kind="resume" for the resuming one.`,
}, []string{"kind"})

ConnLimiterLimits is the gauge vector for showing the configured limits of the number of active stream-connections.

View Source
var DNSCheckErrorTotal = promauto.NewGaugeVec(prometheus.GaugeOpts{
	Name:      "error_total",
	Namespace: namespace,
	Subsystem: subsystemDNSCheck,
	Help:      "The total number of errors with requests to the DNSCheck service.",
}, []string{"source", "type"})

DNSCheckErrorTotal is a gauge with the total number of errors occurred with dnscheck requests. "source" can be "dns" or "http". "type" is either "timeout", "ratelimit" or "other".

View Source
var DNSCheckRequestTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "request_total",
	Namespace: namespace,
	Subsystem: subsystemDNSCheck,
	Help:      "The number of requests to the DNSCheck service.",
}, []string{"type", "valid"})

DNSCheckRequestTotal is a counter with the total number of dnscheck requests. "type" can be "dns" or "http". "valid" can be "1" or "0".

View Source
var DNSSvcFilteringDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "filtering_duration_seconds",
	Namespace: namespace,
	Subsystem: subsystemDNSSvc,
	Help:      "Time elapsed on processing a DNS query.",

	Buckets: []float64{

		0.000001,

		0.00001,

		0.00005,

		0.0001,

		0.001,

		0.01,
		0.1,
		1,
	},
})

DNSSvcFilteringDuration is a histogram with the durations of actually filtering (e.g. applying filters, safebrowsing, etc) to queries.

View Source
var DNSSvcRequestByASNTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "request_per_asn_total",
	Namespace: namespace,
	Subsystem: subsystemDNSSvc,
	Help:      "The number of processed DNS requests labeled by country and ASN.",
	ConstLabels: prometheus.Labels{
		dontStoreLabel: dontStoreLabelValue,
	},
}, []string{"country", "asn"})

DNSSvcRequestByASNTotal is a counter with the total number of queries processed labeled by country and AS number.

View Source
var DNSSvcRequestByCountryTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "request_per_country_total",
	Namespace: namespace,
	Subsystem: subsystemDNSSvc,
	Help:      "The number of processed DNS requests labeled by country and continent.",
}, []string{"continent", "country"})

DNSSvcRequestByCountryTotal is a counter with the total number of queries processed labeled by country and continent.

View Source
var DNSSvcRequestByFilterTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "request_per_filter_total",
	Namespace: namespace,
	Subsystem: subsystemDNSSvc,
	Help:      "The number of filtered DNS requests labeled by filter applied.",
}, []string{"filter", "anonymous"})

DNSSvcRequestByFilterTotal is a counter with the total number of queries processed labeled by filter. Processed could mean that the request was blocked or unblocked by a rule from that filter list. "filter" contains the ID of the filter list applied. "anonymous" is "0" if the request is from a AdGuard DNS customer, otherwise it is "1".

View Source
var DNSSvcUnknownDedicatedTotal = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "unknown_dedicated",
	Namespace: namespace,
	Subsystem: subsystemDNSSvc,
	Help:      "The number of dropped queries for unrecognized dedicated addresses.",
})

DNSSvcUnknownDedicatedTotal is the counter of queries that have been dropped, because the local-address data was not recognized.

View Source
var DevicesCountGauge = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "devices_total",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The total number of user devices loaded from the backend.",
})

DevicesCountGauge is a gauge with the total number of user devices loaded from the backend.

View Source
var DevicesInvalidTotal = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "devices_invalid_total",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The total number of invalid user devices loaded from the backend.",
})

DevicesInvalidTotal is a gauge with the number of invalid user devices loaded from the backend.

View Source
var DevicesNewCountGauge = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "devices_newly_synced_total",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The number of user devices that were changed or added since the previous sync.",
})

DevicesNewCountGauge is a gauge with the number of user devices downloaded during the last sync.

View Source
var GRPCAvgProfileDecDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "grpc_avg_profile_dec_duration_seconds",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help: "The average duration of decoding one profile during a call to the backend, " +
		"in seconds.",
	Buckets: []float64{0.000_001, 0.000_01, 0.000_1, 0.001},
})

GRPCAvgProfileDecDuration is a histogram with the average duration of decoding a single profile during a backend call.

View Source
var GRPCAvgProfileRecvDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "grpc_avg_profile_recv_duration_seconds",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help: "The average duration of a receive of a profile during a call to the backend, " +
		"in seconds.",
	Buckets: []float64{0.000_001, 0.000_010, 0.000_100, 0.001},
})

GRPCAvgProfileRecvDuration is a histogram with the average duration of a receive of a single profile during a backend call.

View Source
var ProfilesCountGauge = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "profiles_total",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The total number of user profiles loaded from the backend.",
})

ProfilesCountGauge is a gauge with the total number of user profiles loaded from the backend.

View Source
var ProfilesFullSyncDuration = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "profiles_full_sync_duration_seconds",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "Time elapsed on fully syncing user profiles with the backend, in seconds.",
})

ProfilesFullSyncDuration is a gauge with the duration of the last full sync. It is a gauge because full syncs are not expected to be common.

View Source
var ProfilesNewCountGauge = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "profiles_newly_synced_total",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The number of user profiles that were changed or added since the previous sync.",
})

ProfilesNewCountGauge is a gauge with the number of user profiles downloaded during the last sync.

View Source
var ProfilesSyncDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "profiles_sync_duration_seconds",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "Time elapsed on syncing user profiles with the backend.",

	Buckets: []float64{0.01, 0.1, 1, 5, 10, 30, 60, 120, 240},
})

ProfilesSyncDuration is a histogram with the duration of a profiles sync.

View Source
var ProfilesSyncStatus = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "profiles_sync_status",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "Status of the last profiles sync. 1 is okay, 0 means there was an error",
})

ProfilesSyncStatus is a gauge with the profiles sync status. Set it to 1 if the sync was successful. Otherwise, set it to 0.

View Source
var ProfilesSyncTime = promauto.NewGauge(prometheus.GaugeOpts{
	Name:      "profiles_sync_timestamp",
	Subsystem: subsystemBackend,
	Namespace: namespace,
	Help:      "The time when the user profiles were synced last time.",
})

ProfilesSyncTime is a gauge with the timestamp when the profiles were synced last time.

View Source
var QueryLogItemSize = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "items_size_bytes",
	Subsystem: subsystemQueryLog,
	Namespace: namespace,
	Help:      "A histogram with the query log items size.",

	Buckets: []float64{50, 100, 200, 300, 400, 600, 800, 1000, 2000},
})

QueryLogItemSize is a histogram with the query log items size.

View Source
var QueryLogItemsCount = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "items_total",
	Subsystem: subsystemQueryLog,
	Namespace: namespace,
	Help:      "The total number of query log items written.",
})

QueryLogItemsCount is a counter with the total number of query log items written to the file.

View Source
var QueryLogWriteDuration = promauto.NewHistogram(prometheus.HistogramOpts{
	Name:      "write_duration_seconds",
	Subsystem: subsystemQueryLog,
	Namespace: namespace,
	Help:      "A histogram with the query log items size.",

	Buckets: []float64{0.00001, 0.0001, 0.001, 0.01, 0.1, 1},
})

QueryLogWriteDuration is a histogram with the time spent writing a query log item to the file.

View Source
var ResearchBlockedRequestsPerCountryTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "blocked_per_country_total",
	Namespace: namespace,
	Subsystem: subsystemResearch,
	Help:      "The number of blocked DNS queries per country from anonymous users.",
}, []string{"filter", "country"})

ResearchBlockedRequestsPerCountryTotal counts the number of blocked queries per country from anonymous users.

View Source
var ResearchBlockedRequestsPerSubdivTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "blocked_per_subdivision_total",
	Namespace: namespace,
	Subsystem: subsystemResearch,
	Help: `The number of blocked DNS queries per countries with top ` +
		`subdivision from anonymous users.`,
}, []string{"filter", "country", "subdivision"})

ResearchBlockedRequestsPerSubdivTotal counts the number of blocked queries per country from anonymous users.

View Source
var ResearchRequestsPerCountryTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "requests_per_country_total",
	Namespace: namespace,
	Subsystem: subsystemResearch,
	Help:      "The total number of DNS queries per country from anonymous users.",
}, []string{"country"})

ResearchRequestsPerCountryTotal counts the total number of queries per country from anonymous users.

View Source
var ResearchRequestsPerSubdivTotal = promauto.NewCounterVec(prometheus.CounterOpts{
	Name:      "requests_per_subdivision_total",
	Namespace: namespace,
	Subsystem: subsystemResearch,
	Help: `The total number of DNS queries per countries with top ` +
		`subdivision from anonymous users.`,
}, []string{"country", "subdivision"})

ResearchRequestsPerSubdivTotal counts the total number of queries per country from anonymous users.

View Source
var ResearchResponseECH = promauto.NewCounter(prometheus.CounterOpts{
	Name:      "response_ech",
	Namespace: namespace,
	Subsystem: subsystemResearch,
	Help:      `The number of DNS responses with a ECH config.`,
})

ResearchResponseECH counts the number of DNS responses with a ECH config.

View Source
var StreamConnLifeDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
	Name:      "stream_conn_life_duration_seconds",
	Subsystem: subsystemConnLimiter,
	Namespace: namespace,
	Help:      "How long a stream connection lives, in seconds.",
	Buckets:   []float64{0.1, 1, 5, 10, 30, 60},
}, []string{"name", "proto", "addr"})

StreamConnLifeDuration is a histogram with the duration of lives of stream connections.

View Source
var StreamConnWaitDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
	Name:      "stream_conn_wait_duration_seconds",
	Subsystem: subsystemConnLimiter,
	Namespace: namespace,
	Help:      "How long a stream connection waits for an accept, in seconds.",
	Buckets:   []float64{0.00001, 0.01, 0.1, 1, 10, 30, 60},
}, []string{"name", "proto", "addr"})

StreamConnWaitDuration is a histogram with the duration of waiting times for accepting stream connections.

Functions

func BoolString

func BoolString(cond bool) (s string)

BoolString returns "1" if cond is true and "0" otherwise.

func DNSSvcUsersCountUpdate

func DNSSvcUsersCountUpdate(ip netip.Addr)

DNSSvcUsersCountUpdate records a visit by ip and updates the values of the [dnsSvcUsersCount] and [dnsSvcUsersDailyCount] gauges every second.

func IncrementCond

func IncrementCond(cond bool, trueCounter, falseCounter prometheus.Counter)

IncrementCond increments trueCounter if cond is true and falseCounter otherwise.

func ReportResearch

func ReportResearch(data *ResearchData, researchLogs bool)

ReportResearch reports metrics to prometheus that we may need to conduct researches. If researchLogs is true, this method may also write additional INFO-level logs.

func SetAdditionalInfo

func SetAdditionalInfo(info map[string]string)

SetAdditionalInfo adds a gauge with extra info labels. If info is nil, SetAdditionalInfo does nothing.

func SetStatusGauge

func SetStatusGauge(gauge prometheus.Gauge, err error)

SetStatusGauge is a helper function that automatically checks if there's an error and sets the gauge to either 1 (success) or 0 (error).

func SetUpGauge

func SetUpGauge(version, buildtime, branch, revision, goversion string)

SetUpGauge signals that the server has been started. Use a function here to avoid circular dependencies.

func TLSMetricsAfterHandshake

func TLSMetricsAfterHandshake(
	proto string,
	srvName string,
	wildcards []string,
	srvCerts []tls.Certificate,
) (f func(tls.ConnectionState) error)

TLSMetricsAfterHandshake is a function that needs to be passed to *tls.Config VerifyConnection.

func TLSMetricsBeforeHandshake

func TLSMetricsBeforeHandshake(proto string) (f func(*tls.ClientHelloInfo) (*tls.Config, error))

TLSMetricsBeforeHandshake is a function that needs to be passed to *tls.Config GetConfigForClient.

Types

type ClonerStat

type ClonerStat struct{}

ClonerStat is the Prometheus-based implementation of the dnsmsg.ClonerStat interface.

func (ClonerStat) OnClone

func (ClonerStat) OnClone(isFull bool)

OnClone implements the dnsmsg.ClonerStat interface for ClonerStat.

type ResearchData

type ResearchData struct {
	OriginalResponse *dns.Msg
	FilterID         string
	Country          string
	TopSubdivision   string
	Host             string
	QType            uint16
	Blocked          bool
}

ResearchData contains data for research metrics.

Jump to

Keyboard shortcuts

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