Documentation
¶
Overview ¶
Package logging provides a GORM-based logging plugin for Bifrost. This plugin stores comprehensive logs of all requests and responses with search, filter, and pagination capabilities.
Package logging provides database operations for the GORM-based logging plugin ¶
Package logging provides utility functions and interfaces for the GORM-based logging plugin
Index ¶
- Constants
- type Config
- type InitialLogData
- type KeyPair
- type LogCallback
- type LogManager
- type LogMessage
- type LogOperation
- type LoggerPlugin
- func (p *LoggerPlugin) Cleanup() error
- func (p *LoggerPlugin) GetAvailableMCPVirtualKeys(ctx context.Context) []KeyPair
- func (p *LoggerPlugin) GetAvailableModels(ctx context.Context) []string
- func (p *LoggerPlugin) GetAvailableRoutingEngines(ctx context.Context) []string
- func (p *LoggerPlugin) GetAvailableRoutingRules(ctx context.Context) []KeyPair
- func (p *LoggerPlugin) GetAvailableSelectedKeys(ctx context.Context) []KeyPair
- func (p *LoggerPlugin) GetAvailableVirtualKeys(ctx context.Context) []KeyPair
- func (p *LoggerPlugin) GetCostHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.CostHistogramResult, error)
- func (p *LoggerPlugin) GetHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.HistogramResult, error)
- func (p *LoggerPlugin) GetModelHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.ModelHistogramResult, error)
- func (p *LoggerPlugin) GetName() string
- func (p *LoggerPlugin) GetPluginLogManager() *PluginLogManager
- func (p *LoggerPlugin) GetStats(ctx context.Context, filters logstore.SearchFilters) (*logstore.SearchStats, error)
- func (p *LoggerPlugin) GetTokenHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.TokenHistogramResult, error)
- func (p *LoggerPlugin) HTTPTransportPostHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, ...) error
- func (p *LoggerPlugin) HTTPTransportPreHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest) (*schemas.HTTPResponse, error)
- func (p *LoggerPlugin) HTTPTransportStreamChunkHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, ...) (*schemas.BifrostStreamChunk, error)
- func (p *LoggerPlugin) PostLLMHook(ctx *schemas.BifrostContext, result *schemas.BifrostResponse, ...) (*schemas.BifrostResponse, *schemas.BifrostError, error)
- func (p *LoggerPlugin) PostMCPHook(ctx *schemas.BifrostContext, resp *schemas.BifrostMCPResponse, ...) (*schemas.BifrostMCPResponse, *schemas.BifrostError, error)
- func (p *LoggerPlugin) PreLLMHook(ctx *schemas.BifrostContext, req *schemas.BifrostRequest) (*schemas.BifrostRequest, *schemas.LLMPluginShortCircuit, error)
- func (p *LoggerPlugin) PreMCPHook(ctx *schemas.BifrostContext, req *schemas.BifrostMCPRequest) (*schemas.BifrostMCPRequest, *schemas.MCPPluginShortCircuit, error)
- func (p *LoggerPlugin) RecalculateCosts(ctx context.Context, filters logstore.SearchFilters, limit int) (*RecalculateCostResult, error)
- func (p *LoggerPlugin) SearchLogs(ctx context.Context, filters logstore.SearchFilters, ...) (*logstore.SearchResult, error)
- func (p *LoggerPlugin) SetLogCallback(callback LogCallback)
- func (p *LoggerPlugin) SetMCPToolLogCallback(callback MCPToolLogCallback)
- type MCPToolLogCallback
- type PluginLogManager
- func (p *PluginLogManager) DeleteLog(ctx context.Context, id string) error
- func (p *PluginLogManager) DeleteLogs(ctx context.Context, ids []string) error
- func (p *PluginLogManager) DeleteMCPToolLogs(ctx context.Context, ids []string) error
- func (p *PluginLogManager) GetAvailableMCPVirtualKeys(ctx context.Context) []KeyPair
- func (p *PluginLogManager) GetAvailableModels(ctx context.Context) []string
- func (p *PluginLogManager) GetAvailableRoutingEngines(ctx context.Context) []string
- func (p *PluginLogManager) GetAvailableRoutingRules(ctx context.Context) []KeyPair
- func (p *PluginLogManager) GetAvailableSelectedKeys(ctx context.Context) []KeyPair
- func (p *PluginLogManager) GetAvailableServerLabels(ctx context.Context) ([]string, error)
- func (p *PluginLogManager) GetAvailableToolNames(ctx context.Context) ([]string, error)
- func (p *PluginLogManager) GetAvailableVirtualKeys(ctx context.Context) []KeyPair
- func (p *PluginLogManager) GetCostHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.CostHistogramResult, error)
- func (p *PluginLogManager) GetDroppedRequests(ctx context.Context) int64
- func (p *PluginLogManager) GetHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.HistogramResult, error)
- func (p *PluginLogManager) GetMCPToolLogStats(ctx context.Context, filters *logstore.MCPToolLogSearchFilters) (*logstore.MCPToolLogStats, error)
- func (p *PluginLogManager) GetModelHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.ModelHistogramResult, error)
- func (p *PluginLogManager) GetStats(ctx context.Context, filters *logstore.SearchFilters) (*logstore.SearchStats, error)
- func (p *PluginLogManager) GetTokenHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.TokenHistogramResult, error)
- func (p *PluginLogManager) RecalculateCosts(ctx context.Context, filters *logstore.SearchFilters, limit int) (*RecalculateCostResult, error)
- func (p *PluginLogManager) Search(ctx context.Context, filters *logstore.SearchFilters, ...) (*logstore.SearchResult, error)
- func (p *PluginLogManager) SearchMCPToolLogs(ctx context.Context, filters *logstore.MCPToolLogSearchFilters, ...) (*logstore.MCPToolLogSearchResult, error)
- type RecalculateCostResult
- type UpdateLogData
Constants ¶
const (
PluginName = "logging"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.3.27
type Config struct {
DisableContentLogging *bool `json:"disable_content_logging"`
}
type InitialLogData ¶
type InitialLogData struct {
Provider string
Model string
Object string
InputHistory []schemas.ChatMessage
ResponsesInputHistory []schemas.ResponsesMessage
Params interface{}
SpeechInput *schemas.SpeechInput
TranscriptionInput *schemas.TranscriptionInput
ImageGenerationInput *schemas.ImageGenerationInput
Tools []schemas.ChatTool
}
InitialLogData contains data for initial log entry creation
type LogCallback ¶
LogCallback is a function that gets called when a new log entry is created
type LogManager ¶
type LogManager interface {
// Search searches for log entries based on filters and pagination
Search(ctx context.Context, filters *logstore.SearchFilters, pagination *logstore.PaginationOptions) (*logstore.SearchResult, error)
// GetStats calculates statistics for logs matching the given filters
GetStats(ctx context.Context, filters *logstore.SearchFilters) (*logstore.SearchStats, error)
// GetHistogram returns time-bucketed request counts for the given filters
GetHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.HistogramResult, error)
// GetTokenHistogram returns time-bucketed token usage for the given filters
GetTokenHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.TokenHistogramResult, error)
// GetCostHistogram returns time-bucketed cost data with model breakdown for the given filters
GetCostHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.CostHistogramResult, error)
// GetModelHistogram returns time-bucketed model usage with success/error breakdown for the given filters
GetModelHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.ModelHistogramResult, error)
// Get the number of dropped requests
GetDroppedRequests(ctx context.Context) int64
// GetAvailableModels returns all unique models from logs
GetAvailableModels(ctx context.Context) []string
// GetAvailableSelectedKeys returns all unique selected key ID-Name pairs from logs
GetAvailableSelectedKeys(ctx context.Context) []KeyPair
// GetAvailableVirtualKeys returns all unique virtual key ID-Name pairs from logs
GetAvailableVirtualKeys(ctx context.Context) []KeyPair
// GetAvailableRoutingRules returns all unique routing rule ID-Name pairs from logs
GetAvailableRoutingRules(ctx context.Context) []KeyPair
// GetAvailableRoutingEngines returns all unique routing engine types from logs
GetAvailableRoutingEngines(ctx context.Context) []string
// DeleteLog deletes a log entry by its ID
DeleteLog(ctx context.Context, id string) error
// DeleteLogs deletes multiple log entries by their IDs
DeleteLogs(ctx context.Context, ids []string) error
// RecalculateCosts recomputes missing costs for logs matching the filters
RecalculateCosts(ctx context.Context, filters *logstore.SearchFilters, limit int) (*RecalculateCostResult, error)
// MCP Tool Log methods
// SearchMCPToolLogs searches for MCP tool log entries based on filters and pagination
SearchMCPToolLogs(ctx context.Context, filters *logstore.MCPToolLogSearchFilters, pagination *logstore.PaginationOptions) (*logstore.MCPToolLogSearchResult, error)
// GetMCPToolLogStats calculates statistics for MCP tool logs matching the given filters
GetMCPToolLogStats(ctx context.Context, filters *logstore.MCPToolLogSearchFilters) (*logstore.MCPToolLogStats, error)
// GetAvailableToolNames returns all unique tool names from MCP tool logs
GetAvailableToolNames(ctx context.Context) ([]string, error)
// GetAvailableServerLabels returns all unique server labels from MCP tool logs
GetAvailableServerLabels(ctx context.Context) ([]string, error)
// GetAvailableMCPVirtualKeys returns all unique virtual key ID-Name pairs from MCP tool logs
GetAvailableMCPVirtualKeys(ctx context.Context) []KeyPair
// DeleteMCPToolLogs deletes multiple MCP tool log entries by their IDs
DeleteMCPToolLogs(ctx context.Context, ids []string) error
}
LogManager defines the main interface that combines all logging functionality
type LogMessage ¶
type LogMessage struct {
Operation LogOperation
RequestID string // Unique ID for the request
ParentRequestID string // Unique ID for the parent request (used for fallback requests)
NumberOfRetries int // Number of retries
FallbackIndex int // Fallback index
SelectedKeyID string // Selected key ID
SelectedKeyName string // Selected key name
VirtualKeyID string // Virtual key ID
VirtualKeyName string // Virtual key name
RoutingEnginesUsed []string // List of routing engines used
RoutingRuleID string // Routing rule ID
RoutingRuleName string // Routing rule name
Timestamp time.Time // Of the preHook/postHook call
Latency int64 // For latency updates
InitialData *InitialLogData // For create operations
SemanticCacheDebug *schemas.BifrostCacheDebug // For semantic cache operations
UpdateData *UpdateLogData // For update operations
StreamResponse *streaming.ProcessedStreamResponse // For streaming delta updates
RoutingEngineLogs string // Formatted routing engine decision logs
}
LogMessage represents a message in the logging queue
type LogOperation ¶
type LogOperation string
LogOperation represents the type of logging operation
const ( LogOperationCreate LogOperation = "create" LogOperationUpdate LogOperation = "update" LogOperationStreamUpdate LogOperation = "stream_update" )
type LoggerPlugin ¶
type LoggerPlugin struct {
// contains filtered or unexported fields
}
LoggerPlugin implements the schemas.LLMPlugin and schemas.MCPPlugin interfaces
func Init ¶
func Init(ctx context.Context, config *Config, logger schemas.Logger, logsStore logstore.LogStore, pricingManager *modelcatalog.ModelCatalog, mcpCatalog *mcpcatalog.MCPCatalog) (*LoggerPlugin, error)
Init creates new logger plugin with given log store
func (*LoggerPlugin) Cleanup ¶
func (p *LoggerPlugin) Cleanup() error
Cleanup is called when the plugin is being shut down
func (*LoggerPlugin) GetAvailableMCPVirtualKeys ¶ added in v1.4.17
func (p *LoggerPlugin) GetAvailableMCPVirtualKeys(ctx context.Context) []KeyPair
GetAvailableMCPVirtualKeys returns all unique virtual key ID-Name pairs from MCP tool logs
func (*LoggerPlugin) GetAvailableModels ¶
func (p *LoggerPlugin) GetAvailableModels(ctx context.Context) []string
GetAvailableModels returns all unique models from logs
func (*LoggerPlugin) GetAvailableRoutingEngines ¶ added in v1.4.19
func (p *LoggerPlugin) GetAvailableRoutingEngines(ctx context.Context) []string
GetAvailableRoutingEngines returns all unique routing engine types used in logs
func (*LoggerPlugin) GetAvailableRoutingRules ¶ added in v1.4.17
func (p *LoggerPlugin) GetAvailableRoutingRules(ctx context.Context) []KeyPair
func (*LoggerPlugin) GetAvailableSelectedKeys ¶ added in v1.3.24
func (p *LoggerPlugin) GetAvailableSelectedKeys(ctx context.Context) []KeyPair
func (*LoggerPlugin) GetAvailableVirtualKeys ¶ added in v1.3.24
func (p *LoggerPlugin) GetAvailableVirtualKeys(ctx context.Context) []KeyPair
func (*LoggerPlugin) GetCostHistogram ¶ added in v1.4.13
func (p *LoggerPlugin) GetCostHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.CostHistogramResult, error)
GetCostHistogram returns time-bucketed cost data with model breakdown for the given filters
func (*LoggerPlugin) GetHistogram ¶ added in v1.4.13
func (p *LoggerPlugin) GetHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.HistogramResult, error)
GetHistogram returns time-bucketed request counts for the given filters
func (*LoggerPlugin) GetModelHistogram ¶ added in v1.4.13
func (p *LoggerPlugin) GetModelHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.ModelHistogramResult, error)
GetModelHistogram returns time-bucketed model usage with success/error breakdown for the given filters
func (*LoggerPlugin) GetName ¶
func (p *LoggerPlugin) GetName() string
GetName returns the name of the plugin
func (*LoggerPlugin) GetPluginLogManager ¶
func (p *LoggerPlugin) GetPluginLogManager() *PluginLogManager
GetPluginLogManager returns a LogManager interface for this plugin
func (*LoggerPlugin) GetStats ¶ added in v1.3.32
func (p *LoggerPlugin) GetStats(ctx context.Context, filters logstore.SearchFilters) (*logstore.SearchStats, error)
GetStats calculates statistics for logs matching the given filters
func (*LoggerPlugin) GetTokenHistogram ¶ added in v1.4.13
func (p *LoggerPlugin) GetTokenHistogram(ctx context.Context, filters logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.TokenHistogramResult, error)
GetTokenHistogram returns time-bucketed token usage for the given filters
func (*LoggerPlugin) HTTPTransportPostHook ¶ added in v1.4.9
func (p *LoggerPlugin) HTTPTransportPostHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, resp *schemas.HTTPResponse) error
HTTPTransportPostHook is not used for this plugin
func (*LoggerPlugin) HTTPTransportPreHook ¶ added in v1.4.9
func (p *LoggerPlugin) HTTPTransportPreHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest) (*schemas.HTTPResponse, error)
HTTPTransportPreHook is not used for this plugin
func (*LoggerPlugin) HTTPTransportStreamChunkHook ¶ added in v1.4.15
func (p *LoggerPlugin) HTTPTransportStreamChunkHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, chunk *schemas.BifrostStreamChunk) (*schemas.BifrostStreamChunk, error)
HTTPTransportStreamChunkHook passes through streaming chunks unchanged
func (*LoggerPlugin) PostLLMHook ¶ added in v1.4.17
func (p *LoggerPlugin) PostLLMHook(ctx *schemas.BifrostContext, result *schemas.BifrostResponse, bifrostErr *schemas.BifrostError) (*schemas.BifrostResponse, *schemas.BifrostError, error)
PostLLMHook is called after a response is received - FULLY ASYNC, NO DATABASE I/O Parameters:
- ctx: The Bifrost context
- result: The Bifrost response to be processed
- bifrostErr: The Bifrost error to be processed
Returns:
- *schemas.BifrostResponse: The processed response
- *schemas.BifrostError: The processed error
- error: Any error that occurred during processing
func (*LoggerPlugin) PostMCPHook ¶ added in v1.4.17
func (p *LoggerPlugin) PostMCPHook(ctx *schemas.BifrostContext, resp *schemas.BifrostMCPResponse, bifrostErr *schemas.BifrostError) (*schemas.BifrostMCPResponse, *schemas.BifrostError, error)
PostMCPHook is called after an MCP tool execution - updates the log entry with results Parameters:
- ctx: The Bifrost context
- resp: The MCP response containing tool execution result
- bifrostErr: Any error that occurred during execution
Returns:
- *schemas.BifrostMCPResponse: The unmodified response
- *schemas.BifrostError: The unmodified error
- error: nil (errors are logged but don't fail the request)
func (*LoggerPlugin) PreLLMHook ¶ added in v1.4.17
func (p *LoggerPlugin) PreLLMHook(ctx *schemas.BifrostContext, req *schemas.BifrostRequest) (*schemas.BifrostRequest, *schemas.LLMPluginShortCircuit, error)
PreLLMHook is called before a request is processed - FULLY ASYNC, NO DATABASE I/O Parameters:
- ctx: The Bifrost context
- req: The Bifrost request
Returns:
- *schemas.BifrostRequest: The processed request
- *schemas.LLMPluginShortCircuit: The plugin short circuit if the request is not allowed
- error: Any error that occurred during processing
func (*LoggerPlugin) PreMCPHook ¶ added in v1.4.17
func (p *LoggerPlugin) PreMCPHook(ctx *schemas.BifrostContext, req *schemas.BifrostMCPRequest) (*schemas.BifrostMCPRequest, *schemas.MCPPluginShortCircuit, error)
PreMCPHook is called before an MCP tool execution - creates initial log entry Parameters:
- ctx: The Bifrost context
- req: The MCP request containing tool call information
Returns:
- *schemas.BifrostMCPRequest: The unmodified request
- *schemas.MCPPluginShortCircuit: nil (no short-circuiting)
- error: nil (errors are logged but don't fail the request)
func (*LoggerPlugin) RecalculateCosts ¶ added in v1.3.50
func (p *LoggerPlugin) RecalculateCosts(ctx context.Context, filters logstore.SearchFilters, limit int) (*RecalculateCostResult, error)
RecalculateCosts recomputes cost for log entries that are missing cost values
func (*LoggerPlugin) SearchLogs ¶
func (p *LoggerPlugin) SearchLogs(ctx context.Context, filters logstore.SearchFilters, pagination logstore.PaginationOptions) (*logstore.SearchResult, error)
SearchLogs searches logs with filters and pagination using GORM
func (*LoggerPlugin) SetLogCallback ¶
func (p *LoggerPlugin) SetLogCallback(callback LogCallback)
SetLogCallback sets a callback function that will be called for each log entry
func (*LoggerPlugin) SetMCPToolLogCallback ¶ added in v1.4.17
func (p *LoggerPlugin) SetMCPToolLogCallback(callback MCPToolLogCallback)
SetMCPToolLogCallback sets a callback function that will be called for each MCP tool log entry
type MCPToolLogCallback ¶ added in v1.4.17
type MCPToolLogCallback func(*logstore.MCPToolLog)
MCPToolLogCallback is a function that gets called when a new MCP tool log entry is created or updated
type PluginLogManager ¶
type PluginLogManager struct {
// contains filtered or unexported fields
}
PluginLogManager implements LogManager interface wrapping the plugin
func (*PluginLogManager) DeleteLog ¶ added in v1.3.37
func (p *PluginLogManager) DeleteLog(ctx context.Context, id string) error
DeleteLog deletes a log from the log store
func (*PluginLogManager) DeleteLogs ¶ added in v1.3.37
func (p *PluginLogManager) DeleteLogs(ctx context.Context, ids []string) error
DeleteLogs deletes multiple logs from the log store
func (*PluginLogManager) DeleteMCPToolLogs ¶ added in v1.4.17
func (p *PluginLogManager) DeleteMCPToolLogs(ctx context.Context, ids []string) error
DeleteMCPToolLogs deletes multiple MCP tool log entries by their IDs
func (*PluginLogManager) GetAvailableMCPVirtualKeys ¶ added in v1.4.17
func (p *PluginLogManager) GetAvailableMCPVirtualKeys(ctx context.Context) []KeyPair
GetAvailableMCPVirtualKeys returns all unique virtual key ID-Name pairs from MCP tool logs
func (*PluginLogManager) GetAvailableModels ¶
func (p *PluginLogManager) GetAvailableModels(ctx context.Context) []string
GetAvailableModels returns all unique models from logs
func (*PluginLogManager) GetAvailableRoutingEngines ¶ added in v1.4.19
func (p *PluginLogManager) GetAvailableRoutingEngines(ctx context.Context) []string
GetAvailableRoutingEngines returns all unique routing engine types from logs
func (*PluginLogManager) GetAvailableRoutingRules ¶ added in v1.4.17
func (p *PluginLogManager) GetAvailableRoutingRules(ctx context.Context) []KeyPair
GetAvailableRoutingRules returns all unique routing rule ID-Name pairs from logs
func (*PluginLogManager) GetAvailableSelectedKeys ¶ added in v1.3.24
func (p *PluginLogManager) GetAvailableSelectedKeys(ctx context.Context) []KeyPair
GetAvailableSelectedKeys returns all unique selected key ID-Name pairs from logs
func (*PluginLogManager) GetAvailableServerLabels ¶ added in v1.4.17
func (p *PluginLogManager) GetAvailableServerLabels(ctx context.Context) ([]string, error)
GetAvailableServerLabels returns all unique server labels from MCP tool logs
func (*PluginLogManager) GetAvailableToolNames ¶ added in v1.4.17
func (p *PluginLogManager) GetAvailableToolNames(ctx context.Context) ([]string, error)
GetAvailableToolNames returns all unique tool names from MCP tool logs
func (*PluginLogManager) GetAvailableVirtualKeys ¶ added in v1.3.24
func (p *PluginLogManager) GetAvailableVirtualKeys(ctx context.Context) []KeyPair
GetAvailableVirtualKeys returns all unique virtual key ID-Name pairs from logs
func (*PluginLogManager) GetCostHistogram ¶ added in v1.4.13
func (p *PluginLogManager) GetCostHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.CostHistogramResult, error)
func (*PluginLogManager) GetDroppedRequests ¶
func (p *PluginLogManager) GetDroppedRequests(ctx context.Context) int64
func (*PluginLogManager) GetHistogram ¶ added in v1.4.13
func (p *PluginLogManager) GetHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.HistogramResult, error)
func (*PluginLogManager) GetMCPToolLogStats ¶ added in v1.4.17
func (p *PluginLogManager) GetMCPToolLogStats(ctx context.Context, filters *logstore.MCPToolLogSearchFilters) (*logstore.MCPToolLogStats, error)
GetMCPToolLogStats calculates statistics for MCP tool logs matching the given filters
func (*PluginLogManager) GetModelHistogram ¶ added in v1.4.13
func (p *PluginLogManager) GetModelHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.ModelHistogramResult, error)
func (*PluginLogManager) GetStats ¶ added in v1.3.32
func (p *PluginLogManager) GetStats(ctx context.Context, filters *logstore.SearchFilters) (*logstore.SearchStats, error)
func (*PluginLogManager) GetTokenHistogram ¶ added in v1.4.13
func (p *PluginLogManager) GetTokenHistogram(ctx context.Context, filters *logstore.SearchFilters, bucketSizeSeconds int64) (*logstore.TokenHistogramResult, error)
func (*PluginLogManager) RecalculateCosts ¶ added in v1.3.50
func (p *PluginLogManager) RecalculateCosts(ctx context.Context, filters *logstore.SearchFilters, limit int) (*RecalculateCostResult, error)
func (*PluginLogManager) Search ¶
func (p *PluginLogManager) Search(ctx context.Context, filters *logstore.SearchFilters, pagination *logstore.PaginationOptions) (*logstore.SearchResult, error)
func (*PluginLogManager) SearchMCPToolLogs ¶ added in v1.4.17
func (p *PluginLogManager) SearchMCPToolLogs(ctx context.Context, filters *logstore.MCPToolLogSearchFilters, pagination *logstore.PaginationOptions) (*logstore.MCPToolLogSearchResult, error)
SearchMCPToolLogs searches for MCP tool log entries based on filters and pagination
type RecalculateCostResult ¶ added in v1.3.50
type RecalculateCostResult struct {
TotalMatched int64 `json:"total_matched"`
Updated int `json:"updated"`
Skipped int `json:"skipped"`
Remaining int64 `json:"remaining"`
}
RecalculateCostResult represents summary stats from a cost backfill operation
type UpdateLogData ¶
type UpdateLogData struct {
Status string
TokenUsage *schemas.BifrostLLMUsage
Cost *float64 // Cost in dollars from pricing plugin
ListModelsOutput []schemas.Model // For list models requests
ChatOutput *schemas.ChatMessage
ResponsesOutput []schemas.ResponsesMessage
EmbeddingOutput []schemas.EmbeddingData
ErrorDetails *schemas.BifrostError
SpeechOutput *schemas.BifrostSpeechResponse // For non-streaming speech responses
TranscriptionOutput *schemas.BifrostTranscriptionResponse // For non-streaming transcription responses
ImageGenerationOutput *schemas.BifrostImageGenerationResponse // For non-streaming image generation responses
RawRequest interface{}
RawResponse interface{}
}
UpdateLogData contains data for log entry updates