telemetry

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package telemetry exposes engine metrics in the Prometheus format and the admin endpoints (/metrics, /healthz, /readyz).

Index

Constants

View Source
const (
	// ErrInvalidRequest: a request the adapter can't read (a malformed
	// forward-auth, check, ext_proc or SPOE request, or a proxied request
	// with an invalid target or Host), refused without inspection.
	ErrInvalidRequest = "invalid_request"
	// ErrProtocol: a stream or connection that breaks the adapter's
	// protocol (ext_proc, SPOE), closed.
	ErrProtocol = "protocol"
)

Kinds of inkwall_adapter_errors_total.

View Source
const (
	// PanicExtProcStream: an ext_proc stream, ended with an error.
	PanicExtProcStream = "extproc_stream"
	// PanicSPOEConnection: a SPOE connection, closed.
	PanicSPOEConnection = "spoe_connection"
	// PanicSPOENotify: a SPOE NOTIFY frame; its connection is closed.
	PanicSPOENotify = "spoe_notify"
	// PanicWebSocket: the standalone proxy's inspection of a WebSocket's
	// client side; its connection is closed.
	PanicWebSocket = "websocket"
)

Components of inkwall_panics_total: the goroutines that read a proxy's connection, where a recovered panic ends only that stream or connection.

View Source
const (

	// DefaultMaxPolicies bounds inkwall_policy_requests_total's policies;
	// past it, requests count under policy="other".
	DefaultMaxPolicies = 500
)

Bounds on the series of labels whose values the engine doesn't choose.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics records verdicts. It implements pipeline.Observer. Its methods are safe on a nil *Metrics, which records nothing.

func NewMetrics

func NewMetrics(adapter string) *Metrics

NewMetrics returns metrics for one adapter (for example "proxy"), with Go runtime and process collectors registered.

func (*Metrics) AdapterError added in v0.5.0

func (m *Metrics) AdapterError(kind string)

AdapterError counts a request the adapter refused without inspecting it, by kind (ErrInvalidRequest, ErrProtocol).

func (*Metrics) AdminHandler

func (m *Metrics) AdminHandler(ready func() bool) http.Handler

AdminHandler serves /metrics, /healthz (the process is alive) and /readyz (the engine has loaded its rules and can serve; ready is called per probe).

func (*Metrics) ConnectionLimitWait added in v0.5.0

func (m *Metrics) ConnectionLimitWait()

ConnectionLimitWait counts a connection that waits for the limit.

func (*Metrics) ConnectionOpened added in v0.5.0

func (m *Metrics) ConnectionOpened() (closed func())

ConnectionOpened counts an open client connection; the returned func, called once it is closed, uncounts it.

func (*Metrics) EnablePolicyMetrics added in v0.5.0

func (m *Metrics) EnablePolicyMetrics(max int)

EnablePolicyMetrics adds inkwall_policy_requests_total, requests by policy, for at most max distinct policies (DefaultMaxPolicies when 0 or less); past them, requests count under policy="other". Call it before the engine serves.

func (*Metrics) ObserveVerdict

func (m *Metrics) ObserveVerdict(v pipeline.Verdict)

ObserveVerdict records one verdict.

func (*Metrics) Panicked added in v0.6.1

func (m *Metrics) Panicked(ctx context.Context, logger *slog.Logger, component string, v any)

Panicked reports a panic recovered in a goroutine that reads a proxy's connection, by component (PanicExtProcStream...): it logs v and the stack at error level and counts it in inkwall_panics_total. Call it from the deferred function that recovered, then end that stream or connection. On a nil *Metrics it only logs.

func (*Metrics) Register

func (m *Metrics) Register(cs ...prometheus.Collector)

Register adds collectors, such as the bundle agent's, to the engine's metrics.

func (*Metrics) RulesReloaded added in v0.5.0

func (m *Metrics) RulesReloaded(result string)

RulesReloaded counts a reload of the rule files, by result (ok, error).

func (*Metrics) WatchAdmission

func (m *Metrics) WatchAdmission(p *pipeline.Admission)

WatchAdmission exports evaluation slot usage, so saturation (and with it, shed requests) is visible before it happens.

func (*Metrics) WatchRuleSets added in v0.5.0

func (m *Metrics) WatchRuleSets(n func() int)

WatchRuleSets exports the number of compiled rule sets in memory, as n reports it.

func (*Metrics) WebSocketOpened added in v0.5.0

func (m *Metrics) WebSocketOpened() (closed func())

WebSocketOpened counts an open WebSocket connection; the returned function, called when it closes (more than once is fine), uncounts it.

func (*Metrics) WebSocketViolation added in v0.5.0

func (m *Metrics) WebSocketViolation(code int)

WebSocketViolation counts a WebSocket message the proxy couldn't inspect or that broke the protocol, by its close code.

Jump to

Keyboard shortcuts

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