Documentation
¶
Overview ¶
Package telemetry provides RunLore's self-instrumentation: an OpenTelemetry metric set plus a Prometheus-exporter HTTP handler. Instruments are safe to call even when no provider is configured (the global meter is a no-op), so callers never need nil checks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRuntimeGauges ¶
RegisterRuntimeGauges registers async gauges for build info and leadership. Call once after Setup (when a real provider is installed); with the no-op provider it is a harmless no-op. isLeader may be nil (always reports standby). It exposes:
- runlore_build_info{version} = 1 (for `absent()` liveness + version display)
- runlore_leader = 1 when this replica is the elected leader, else 0
Types ¶
type Metrics ¶
type Metrics struct {
AlertsReceived metric.Int64Counter
AlertsCoalesced metric.Int64Counter
AlertsSuppressed metric.Int64Counter
InvestigationsStarted metric.Int64Counter
InvestigationsThrottled metric.Int64Counter
InvestigationsDropped metric.Int64Counter
GitOpsFailuresDebounced metric.Int64Counter // GitOps failures dropped as transient (cleared within the debounce window)
IncidentsDebounced metric.Int64Counter // firing alerts dropped as self-resolving (resolved within the incident debounce window)
ToolOutputTruncatedBytes metric.Int64Counter
HistoryCompactions metric.Int64Counter // mid-loop history compaction events
HistoryElidedBytes metric.Int64Counter // tool-output bytes elided by compaction
HistorySummarizations metric.Int64Counter // compaction events whose elided batch was replaced by a model digest
HistorySummarizeFallbacks metric.Int64Counter // summarize-mode compactions that fell back to plain elision (summarizer error/refusal/truncation)
RecallHits metric.Int64Counter // KB cache hits, labelled by verify result
RecallTokensSaved metric.Int64Counter // estimated tokens saved by a recall short-circuit
RecallRejections metric.Int64Counter // recalls rejected before short-circuit (label: reason)
CoalesceBatchSize metric.Int64Histogram
InvestigationTokens metric.Int64Histogram
// Per-investigation model usage totals (loop + verify), recorded once at
// delivery — the actual provider-reported spend, distinct from the pre-request
// InvestigationTokens estimate.
InvestigationModelCalls metric.Int64Histogram
InvestigationInputTokens metric.Int64Histogram
InvestigationOutputTokens metric.Int64Histogram
InvestigationCachedInputTokens metric.Int64Histogram
InvestigationCostUSD metric.Float64Histogram // estimated per-investigation cost, USD (only when model.pricing is configured)
RecallScore metric.Float64Histogram // BM25 score at the recall decision (tunes min_score)
CurationDedupScore metric.Float64Histogram // catalog top-hit BM25 score at the curation dedup decision
OutcomesOpened metric.Int64Counter // investigations recorded as open (label: kind)
IncidentsResolved metric.Int64Counter // resolve events that matched an open investigation
RecallOutcome metric.Int64Counter // resolved incidents whose open was a recall (label: result)
IncidentResolutionSeconds metric.Float64Histogram // open→resolve duration, seconds
InvestigationDuration metric.Float64Histogram // wall-clock per investigation (label: result)
InvestigationsCompleted metric.Int64Counter // investigations finished (label: result)
ToolCalls metric.Int64Counter // investigation tool calls (label: tool, result)
ToolCallDuration metric.Float64Histogram // tool call latency, seconds (label: tool)
ModelRequests metric.Int64Counter // LLM completion requests (label: provider, result)
ModelRequestDuration metric.Float64Histogram // LLM completion latency, seconds (label: provider)
ModelResponsesTruncated metric.Int64Counter // LLM completions cut off at the output-token ceiling (label: provider)
ModelInputTokens metric.Int64Counter // total input tokens across LLM requests (label: provider)
ModelCachedInputTokens metric.Int64Counter // input tokens served from cache (label: provider)
Curations metric.Int64Counter // curation outcomes (label: kind, result)
CatalogInvalidEntries metric.Int64Counter // structurally-invalid entries found at catalog load
}
Metrics is the RunLore instrument set, created once and shared.
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics builds the instrument set from the global meter provider.
Click to show internal directories.
Click to hide internal directories.