metrics

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metrics owns AgentSQL's private Prometheus registry and observers.

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 owns the process-local AgentSQL Prometheus registry.

func New

func New(poolSnapshot func() []PoolStat) *Metrics

New creates an isolated registry and all AgentSQL collectors.

func (*Metrics) Handler

func (metrics *Metrics) Handler() http.Handler

Handler returns the registry's Prometheus exposition handler.

func (*Metrics) IncRedactionKeyDrift

func (metrics *Metrics) IncRedactionKeyDrift(kind string)

IncRedactionKeyDrift records one bounded reconciliation finding. kind must be supplied by the reconciliation classifier, never from an external error.

func (*Metrics) IncRejected

func (metrics *Metrics) IncRejected(reason string)

IncRejected increments one bounded gateway rejection reason.

func (*Metrics) ObserveB2Phase

func (metrics *Metrics) ObserveB2Phase(phase string, duration time.Duration)

ObserveB2Phase records a phase duration. Phase names are internal constants, never attacker-provided labels.

func (*Metrics) ObserveDecision

func (metrics *Metrics) ObserveDecision(decision, dialect, stmtType string)

ObserveDecision records one final pipeline decision.

func (*Metrics) ObserveHTTP

func (metrics *Metrics) ObserveHTTP(method, route, status string, seconds float64)

ObserveHTTP records one normalized HTTP request and its duration.

func (*Metrics) ObserveRuleHit

func (metrics *Metrics) ObserveRuleHit(ruleID, decision, risk string)

ObserveRuleHit records one rule hit from a final assessment.

func (*Metrics) ObserveStage

func (metrics *Metrics) ObserveStage(stage string, latencyMS int64)

ObserveStage records one final pipeline stage latency after converting ms to seconds.

func (*Metrics) RecordNotificationDropped

func (metrics *Metrics) RecordNotificationDropped(channel string)

RecordNotificationDropped records one queue-full best-effort drop.

func (*Metrics) RecordNotificationFailed

func (metrics *Metrics) RecordNotificationFailed(channel, reason string)

RecordNotificationFailed records a terminal delivery failure. reason is a bounded category supplied by notify and never contains a URL or payload.

func (*Metrics) RecordNotificationSent

func (metrics *Metrics) RecordNotificationSent(channel string, at time.Time)

RecordNotificationSent records a completed delivery and clears last_error.

func (*Metrics) SetAuditChainLastVerified

func (metrics *Metrics) SetAuditChainLastVerified(domain string, at time.Time)

SetAuditChainLastVerified records the completion time of the latest verification.

func (*Metrics) SetAuditChainValid

func (metrics *Metrics) SetAuditChainValid(domain string, valid bool)

SetAuditChainValid updates whether the latest verification reached a valid observed head.

func (*Metrics) SetAuditChainVerificationLag

func (metrics *Metrics) SetAuditChainVerificationLag(domain string, lagging bool)

SetAuditChainVerificationLag updates the domain-scoped verification lag alarm.

func (*Metrics) SetAuditWriterReady

func (metrics *Metrics) SetAuditWriterReady(domain string, ready bool)

SetAuditWriterReady updates the domain-scoped audit writer key readiness.

func (*Metrics) SetB2State

func (metrics *Metrics) SetB2State(state string)

SetB2State updates the one-hot activation/readiness state.

func (*Metrics) SetOutboxPending

func (metrics *Metrics) SetOutboxPending(count int, oldestAge time.Duration)

SetOutboxPending updates the current management audit backlog gauges.

type PoolStat

type PoolStat struct {
	DatasourceID string
	Dialect      string
	MaxOpen      int
	InUse        int
	Idle         int
}

PoolStat is one instantaneous datasource pool snapshot.

Jump to

Keyboard shortcuts

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