Versions in this module Expand all Collapse all v0 v0.4.3 Jul 11, 2026 Changes in this version + func Bool(v bool) *bool + func ContextWithSpan(ctx context.Context, span InteractionSpan) context.Context + func GenerateSpanID() string + func GenerateTraceID() string + func Int(v int) *int + func RenderPrometheus(snap PrometheusSnapshot, stats RuntimeStats) string + func ValidLowerHex(v string, n int) bool + func ValidSpanID(v string) bool + func ValidTraceID(v string) bool + type ACPExtension struct + AgentType string + EventCounts map[string]int + FreshSession *bool + Operation string + PermissionRequestID string + ResultStatus string + ServiceID string + SessionID string + ThreadID string + UsageJSON string + type ACPSummary struct + AvgLatencyMS int64 + FailureCount int64 + RequestCount int64 + SuccessCount int64 + TurnCount int64 + type ACPUsageEvent struct + AgentType string + EventCounts map[string]int + FreshSession *bool + Operation string + PermissionRequestID string + ResultStatus string + ServiceID string + SessionID string + ThreadID string + UsageJSON string + type AgentAttribution struct + func NewAgentAttribution() *AgentAttribution + func (a *AgentAttribution) ResolveAgentID(routeID, serviceID, sessionID string) (string, bool) + func (a *AgentAttribution) Set(attr AgentAttributor) + type AgentAttributor interface + ResolveAgentID func(routeID, serviceID, sessionID string) (string, bool) + type AttributionFilter struct + ACPServiceIDs []string + AgentID string + RouteIDs []string + func (f *AttributionFilter) IsEmpty() bool + type BreakdownOptions struct + Attribution *AttributionFilter + Filters map[string]string + From string + GroupBy string + Limit int + OrderBy string + To string + type BreakdownResponse struct + GroupBy string + Items []map[string]any + Limit int + type Config struct + MaxAgentDepth int + RetentionDays int + func (c Config) Normalized() Config + type EventListOptions struct + Attribution *AttributionFilter + Filters map[string]string + From string + Limit int + Success *bool + To string + type EventListResponse struct + Items []map[string]any + Limit int + type EventSink interface + Enqueue func(any) bool + type InMemorySink struct + Dropped atomic.Uint64 + Events []any + func (s *InMemorySink) Enqueue(v any) bool + type InteractionDimensions struct + AgentDepth int + AgentID string + ParentSpanID string + RouteID string + RouteKind string + RouteProtocol string + SpanID string + TraceID string + VirtualKeyID string + type InteractionEvent struct + AgentDepth int + AgentID string + ErrorType string + EventID string + FinishedAt time.Time + LatencyMS int64 + ParentSpanID string + RouteID string + RouteKind string + RouteProtocol string + SpanID string + StartedAt time.Time + StatusCode int + Success bool + TraceID string + VirtualKeyID string + type InteractionObserver interface + Begin func(ctx context.Context, dims InteractionDimensions) (InteractionSpan, context.Context) + type InteractionOutcome struct + ErrorType string + FinishedAt time.Time + StatusCode int + Success bool + type InteractionSpan interface + AddAnnotation func(key, value string) + Finish func(outcome InteractionOutcome) + SetExtension func(v any) + func SpanFromContext(ctx context.Context) InteractionSpan + type LLMExtension struct + APIOperation string + CredentialID string + CredentialSource string + InputTokens *int + LLMAPI string + LogicalModel string + OutputTokens *int + ProviderID string + ProviderType string + RequestToolCount *int + RequestToolNames []string + Stream *bool + ToolCallCount *int + ToolNames []string + TotalTokens *int + UpstreamModel string + UsageFinalized *bool + type LLMSummary struct + AvgLatencyMS int64 + FailureCount int64 + InputTokens int64 + OutputTokens int64 + RequestCount int64 + SuccessCount int64 + TotalTokens int64 + type LLMUsageEvent struct + APIOperation string + CredentialID string + CredentialSource string + InputTokens int + LLMAPI string + LogicalModel string + OutputTokens int + ProviderID string + ProviderType string + RequestToolCount int + RequestToolNames []string + Stream bool + ToolCallCount int + ToolNames []string + TotalTokens int + UpstreamModel string + UsageFinalized bool + type MCPExtension struct + ArgCount *int + Cancelled *bool + CompletionArgument string + CompletionRefType string + ExecutedToolName string + ExecutionMode string + Method string + PolicyAction string + PresentedToolName string + PromptName string + RequestID string + ResourceURI string + ResultStatus string + ServiceID string + ToolArgsJSON string + ToolName string + type MCPSummary struct + AvgLatencyMS int64 + FailureCount int64 + RequestCount int64 + SuccessCount int64 + ToolsCallCount int64 + type MCPUsageEvent struct + ArgCount int + Cancelled bool + CompletionArgument string + CompletionRefType string + ExecutedToolName string + ExecutionMode string + Method string + PolicyAction string + PresentedToolName string + PromptName string + RequestID string + ResourceURI string + ResultStatus string + ServiceID string + ToolArgsJSON string + ToolName string + type NoopObserver struct + func (NoopObserver) Begin(ctx context.Context, _ InteractionDimensions) (InteractionSpan, context.Context) + type NoopSpan struct + func (NoopSpan) AddAnnotation(string, string) + func (NoopSpan) Finish(InteractionOutcome) + func (NoopSpan) SetExtension(any) + type Observer struct + func NewObserver(sink EventSink) Observer + func NewObserverWithAttribution(sink EventSink, attribution *AgentAttribution) Observer + func (o Observer) Begin(ctx context.Context, dims InteractionDimensions) (InteractionSpan, context.Context) + type Pipeline interface + Close func() error + DroppedEvents func() uint64 + Start func() + WriteFailures func() uint64 + type PrometheusProvider interface + PrometheusSnapshot func() PrometheusSnapshot + type PrometheusSnapshot struct + FailuresByKind map[string]int64 + RequestsByKind map[string]int64 + TokensByKind map[string]int64 + type QueryService interface + ACPBreakdown func(opts BreakdownOptions) (BreakdownResponse, error) + ACPSummary func(opts BreakdownOptions) (BreakdownResponse, error) + ACPTimeseries func(opts TimeseriesOptions) (SeriesResponse, error) + InteractionsSummary func(opts BreakdownOptions) (BreakdownResponse, error) + LLMBreakdown func(opts BreakdownOptions) (BreakdownResponse, error) + LLMTimeseries func(opts TimeseriesOptions) (SeriesResponse, error) + ListEvents func(kind string, opts EventListOptions) (EventListResponse, error) + ListInteractions func(opts EventListOptions) (EventListResponse, error) + MCPBreakdown func(opts BreakdownOptions) (BreakdownResponse, error) + MCPTimeseries func(opts TimeseriesOptions) (SeriesResponse, error) + MCPToolsSummary func(opts SummaryOptions) (BreakdownResponse, error) + Summary func() (Summary, error) + type RuntimeStats interface + DroppedEvents func() uint64 + WriteFailures func() uint64 + type SQLDBProvider interface + UsageDB func() *gorm.DB + type SeriesResponse struct + Bucket string + GroupBy string + Items []map[string]any + type Summary struct + ACP ACPSummary + LLM LLMSummary + MCP MCPSummary + type SummaryOptions struct + Attribution *AttributionFilter + Filters map[string]string + From string + Limit int + To string + type TimeseriesOptions struct + Attribution *AttributionFilter + Bucket string + Filters map[string]string + From string + GroupBy string + To string + type UsageService struct + func NewUsageService(pipeline Pipeline, query QueryService) *UsageService + func (s *UsageService) AttachPrometheus(p PrometheusProvider) + func (s *UsageService) Attribution() *AgentAttribution + func (s *UsageService) Close() error + func (s *UsageService) DroppedEvents() uint64 + func (s *UsageService) Observer() InteractionObserver + func (s *UsageService) Prometheus() PrometheusProvider + func (s *UsageService) Query() QueryService + func (s *UsageService) Start() + func (s *UsageService) WriteFailures() uint64