Documentation
¶
Overview ¶
Package telemetry tracks lightweight in-memory, per-provider counters so /admin/status can report what the gateway has been doing without needing an external metrics backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProviderStats ¶
type ProviderStats struct {
Requests int64 `json:"requests"`
Failures int64 `json:"failures"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
AvgLatencyMS int64 `json:"avg_latency_ms"`
SuccessRate float64 `json:"success_rate"`
}
ProviderStats is a point-in-time snapshot of one provider's counters.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry aggregates counters per provider ID.
func (*Registry) RecordAttempt ¶
RecordAttempt increments the request counter for a provider.
func (*Registry) RecordFailure ¶
RecordFailure increments the failure counter for a provider.
func (*Registry) RecordLatency ¶
RecordLatency folds one attempt's wall-clock duration into the running average shown in /admin/status.
func (*Registry) RecordUsage ¶
RecordUsage adds prompt/completion token counts for a provider.
func (*Registry) Snapshot ¶
func (r *Registry) Snapshot() map[string]ProviderStats
Snapshot returns a copy of all providers' current stats, keyed by ID.