Documentation
¶
Index ¶
- func GetStatsPath() (string, error)
- type APIResponse
- type EndpointStats
- type Proxy
- type SSEEvent
- type Stats
- func (s *Stats) GetStats() (int, map[string]*EndpointStats)
- func (s *Stats) Load() error
- func (s *Stats) RecordError(endpointName string)
- func (s *Stats) RecordRequest(endpointName string)
- func (s *Stats) RecordTokens(endpointName string, inputTokens, outputTokens int)
- func (s *Stats) Reset()
- func (s *Stats) Save() error
- func (s *Stats) SetStatsPath(path string)
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStatsPath ¶ added in v0.5.2
GetStatsPath returns the stats file path
Types ¶
type APIResponse ¶
type APIResponse struct {
Usage Usage `json:"usage"`
}
APIResponse represents the structure of API responses to extract usage
type EndpointStats ¶
type EndpointStats struct {
Requests int `json:"requests"`
Errors int `json:"errors"`
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
LastUsed time.Time `json:"lastUsed"`
}
EndpointStats represents statistics for a single endpoint
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy represents the proxy server
type Stats ¶
type Stats struct {
TotalRequests int `json:"totalRequests"`
EndpointStats map[string]*EndpointStats `json:"endpointStats"`
// contains filtered or unexported fields
}
Stats represents overall proxy statistics
func (*Stats) GetStats ¶
func (s *Stats) GetStats() (int, map[string]*EndpointStats)
GetStats returns a copy of current statistics (thread-safe)
func (*Stats) RecordError ¶
RecordError records an error for an endpoint
func (*Stats) RecordRequest ¶
RecordRequest records a request for an endpoint
func (*Stats) RecordTokens ¶
RecordTokens records token usage for an endpoint
func (*Stats) SetStatsPath ¶ added in v0.5.2
SetStatsPath sets the path for stats persistence
Click to show internal directories.
Click to hide internal directories.