metrics

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus metrics for the application.

Index

Constants

View Source
const (
	StatusAllowed = "allowed"
	StatusDenied  = "denied"
	StatusInvalid = "invalid"
)

Status label values for the requests counter.

Variables

This section is empty.

Functions

func Handler added in v0.5.2

func Handler() http.Handler

Handler returns an HTTP handler for the metrics endpoint.

func Reset added in v0.5.2

func Reset()

Reset resets all metrics. This is intended for use in tests only.

Types

type PrometheusCollector added in v0.5.2

type PrometheusCollector struct{}

PrometheusCollector implements the Collector interface using Prometheus metrics.

func NewCollector added in v0.5.2

func NewCollector() *PrometheusCollector

NewCollector creates a new PrometheusCollector.

func (*PrometheusCollector) RecordConfigReload added in v0.5.2

func (c *PrometheusCollector) RecordConfigReload(success bool, rulesCount int)

RecordConfigReload records a config reload attempt.

func (*PrometheusCollector) RecordDBUpdate added in v0.5.2

func (c *PrometheusCollector) RecordDBUpdate(
	entries map[ipinfo.DBSource]uint64,
	duration time.Duration,
)

RecordDBUpdate records an IP database update.

func (*PrometheusCollector) RecordInvalidRequest added in v0.5.2

func (c *PrometheusCollector) RecordInvalidRequest(duration time.Duration)

RecordInvalidRequest records metrics for an invalid request.

func (*PrometheusCollector) RecordRequest added in v0.5.2

func (c *PrometheusCollector) RecordRequest(
	status string,
	country string,
	method string,
	duration time.Duration,
	ruleIndex int,
	action string,
	isDefaultPolicy bool,
)

RecordRequest records comprehensive metrics for a request.

Jump to

Keyboard shortcuts

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