Documentation
¶
Overview ¶
Package telemetry provides the metrics of tool calls: a call counter by tool and outcome, a duration histogram by tool, and the audit events dropped, as OpenTelemetry instruments on a meter provider of their own, served in the Prometheus exposition format at /metrics. Hosts that need the metrics elsewhere read them from the Exporter's registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics records tool calls and serves them. The zero value is not usable; construct with NewMetrics.
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics returns an empty collector. It cannot fail with the instruments it declares; an error would be a bug in this package.
func (*Metrics) Hooks ¶
Hooks returns lifecycle hooks that record one counter increment and one duration observation per tool call. Compose with other hooks via hook.Join.
func (*Metrics) Registry ¶ added in v0.1.13
func (m *Metrics) Registry() *prometheus.Registry
Registry is the Prometheus registry the metrics are exported to, for a host serving them alongside its own.
func (*Metrics) ServeHTTP ¶
func (m *Metrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP writes the metrics in the Prometheus text exposition format.
func (*Metrics) SetAuditDropped ¶
SetAuditDropped installs a live reader for the audit drop counter (e.g. audit.AsyncAuditor.Dropped), sampled at scrape time. Set it before the first scrape.