Documentation
¶
Overview ¶
Package metrics owns Peen's application Prometheus registry and its bounded runtime collectors.
Index ¶
- Constants
- type Metrics
- func (m *Metrics) DatabaseCompleted(operation string, table string, outcome string, duration time.Duration)
- func (m *Metrics) DatabasePool(stats sql.DBStats)
- func (m *Metrics) EventDropped(reason string)
- func (m *Metrics) HTTPCompleted(method string, route string, status string, outcome string, ...)
- func (m *Metrics) HTTPStarted()
- func (m *Metrics) Handler() http.Handler
- func (m *Metrics) JobCompleted(operation string, outcome string, duration time.Duration)
- func (m *Metrics) JobOutputDropped(stream string, count int)
- func (m *Metrics) JobStarted()
- func (m *Metrics) ModelCompleted(stage string, function string, model string, outcome string, ...)
- func (m *Metrics) Registry() *prometheus.Registry
- func (m *Metrics) ToolCompleted(tool string, outcome string, duration time.Duration)
- type Server
Constants ¶
const OutcomeCancelled = outcomeCancelled
OutcomeCancelled names an operation ended by cancellation.
const OutcomeError = outcomeError
OutcomeError names an operation which returned an error.
const OutcomeSuccess = outcomeSuccess
OutcomeSuccess names a completed operation without an error.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is the application-owned Prometheus registry. Its methods accept only labels that Peen controls, never request, session, workspace, command, path, prompt, or SQL values.
func New ¶
func New() *Metrics
New constructs one isolated application registry. It intentionally does not use Prometheus's global registry, so tests and embedding programs cannot leak collectors into each other.
func (*Metrics) DatabaseCompleted ¶
func (m *Metrics) DatabaseCompleted( operation string, table string, outcome string, duration time.Duration, )
DatabaseCompleted records one GORM operation. table is reduced to Peen's fixed schema vocabulary before becoming a label.
func (*Metrics) DatabasePool ¶
DatabasePool records a point-in-time SQLite pool snapshot.
func (*Metrics) EventDropped ¶
EventDropped records a durable pending-event or live-subscriber drop.
func (*Metrics) HTTPCompleted ¶
func (m *Metrics) HTTPCompleted( method string, route string, status string, outcome string, duration time.Duration, )
HTTPCompleted records one public HTTP request and removes it from the in-flight gauge. route must be Echo's templated route, never a raw URL.
func (*Metrics) HTTPStarted ¶
func (m *Metrics) HTTPStarted()
HTTPStarted marks one public HTTP request in flight.
func (*Metrics) Handler ¶
Handler returns the OpenMetrics text-compatible Prometheus scrape handler.
func (*Metrics) JobCompleted ¶
JobCompleted records one supervised process result and removes it from the active-job gauge.
func (*Metrics) JobOutputDropped ¶
JobOutputDropped records lines discarded from a completed job's bounded stdout or stderr buffer.
func (*Metrics) JobStarted ¶
func (m *Metrics) JobStarted()
JobStarted increments the number of supervised process jobs currently live.
func (*Metrics) ModelCompleted ¶
func (m *Metrics) ModelCompleted( stage string, function string, model string, outcome string, duration time.Duration, timeToFirstToken time.Duration, inputTokens int64, outputTokens int64, )
ModelCompleted records one whole Elelem request. input and output counts are the request's final run totals, already accumulated by Elelem across rounds.
func (*Metrics) Registry ¶
func (m *Metrics) Registry() *prometheus.Registry
Registry returns the registry owned by this Metrics instance.