metrics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus-format metrics collection and export.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

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

Counter is a monotonically increasing metric.

func (*Counter) Add

func (c *Counter) Add(n int64, labels map[string]string)

func (*Counter) Inc

func (c *Counter) Inc(labels map[string]string)

type Gauge

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

Gauge is a metric that can go up and down.

func (*Gauge) Set

func (g *Gauge) Set(v float64)

type Histogram

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

Histogram tracks value distributions in configurable buckets.

func (*Histogram) Observe

func (h *Histogram) Observe(v float64)

type Registry

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

Registry holds all Chronos metrics and serves them in Prometheus format.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new metrics registry with pre-defined Chronos metrics.

func (*Registry) AddTokens

func (r *Registry) AddTokens(provider string, count int64)

AddTokens adds to the token usage counter.

func (*Registry) Counter

func (r *Registry) Counter(name, help string) *Counter

Counter returns or creates a counter metric.

func (*Registry) Gauge

func (r *Registry) Gauge(name, help string) *Gauge

Gauge returns or creates a gauge metric.

func (*Registry) Handler

func (r *Registry) Handler() http.Handler

Handler returns an http.Handler that serves metrics in Prometheus format.

func (*Registry) Histogram

func (r *Registry) Histogram(name, help string, buckets []float64) *Histogram

Histogram returns or creates a histogram metric.

func (*Registry) IncAgentRuns

func (r *Registry) IncAgentRuns(agentID string)

IncAgentRuns increments the agent runs counter.

func (*Registry) IncToolCalls

func (r *Registry) IncToolCalls(toolName string)

IncToolCalls increments the tool calls counter.

func (*Registry) ObserveModelLatency

func (r *Registry) ObserveModelLatency(provider string, d time.Duration)

ObserveModelLatency records a model call latency.

func (*Registry) SetActiveSessions

func (r *Registry) SetActiveSessions(n float64)

SetActiveSessions sets the active session count.

Jump to

Keyboard shortcuts

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