metric

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package metric holds the OpenTelemetry instruments used to observe the audit pipeline. Labels are limited to low-cardinality dimensions (auth_type, decision) so a hostile client cannot explode the metric cardinality; per-subject / per-issuer detection is the job of the Valkey rate store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics bundles the audit-pipeline instruments. All methods are safe to call on a nil *Metrics (they become no-ops), so call sites need not guard.

func New

func New(meter metric.Meter) (*Metrics, error)

New builds the audit instruments from the given meter. When meter is nil the global MeterProvider installed by otlp.Init is used. It returns an error if any instrument fails to register.

func (*Metrics) AddQueueDepth

func (m *Metrics) AddQueueDepth(ctx context.Context, delta int64)

AddQueueDepth adjusts the current audit queue depth by delta (+1 on enqueue, -1 on drain).

func (*Metrics) IncDropped

func (m *Metrics) IncDropped(ctx context.Context)

IncDropped records an audit event that was dropped due to a full queue.

func (*Metrics) IncPanic

func (m *Metrics) IncPanic(ctx context.Context)

IncPanic records an audit dispatch job that panicked and was recovered.

func (*Metrics) IncRateStoreError

func (m *Metrics) IncRateStoreError(ctx context.Context)

IncRateStoreError records a Valkey rate-store failure.

func (*Metrics) IncUnauthenticated

func (m *Metrics) IncUnauthenticated(ctx context.Context, authType string)

IncUnauthenticated records an observed unauthenticated result.

func (*Metrics) IncUnauthorized

func (m *Metrics) IncUnauthorized(ctx context.Context, authType, decision string)

IncUnauthorized records an observed unauthorised result.

Jump to

Keyboard shortcuts

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