metrics

package
v0.0.0-7b61b67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalStore = NewMemoryStore()

Functions

This section is empty.

Types

type DailyStats

type DailyStats struct {
	ReqCount            int64   `json:"req_count"`
	InputTokens         int64   `json:"input_tokens"`
	OutputTokens        int64   `json:"output_tokens"`
	CachedTokens        int64   `json:"cached_tokens"`
	CacheCreationTokens int64   `json:"cache_creation_tokens"`
	Cost                float64 `json:"cost"`
}

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) GetDailyStats

func (s *MemoryStore) GetDailyStats(dateStr string) DailyStats

func (*MemoryStore) GetEndpointStatus

func (s *MemoryStore) GetEndpointStatus(endpointID string, minute int64) (int64, int64)

func (*MemoryStore) GetGlobalStatus

func (s *MemoryStore) GetGlobalStatus(minute int64) (int64, int64)

func (*MemoryStore) GetModelStatus

func (s *MemoryStore) GetModelStatus(modelCode string, minute int64) (int64, int64)

func (*MemoryStore) GetOpenEndpoints

func (s *MemoryStore) GetOpenEndpoints() []string

func (*MemoryStore) GetOpenServices

func (s *MemoryStore) GetOpenServices() []string

func (*MemoryStore) Record

func (s *MemoryStore) Record(m RequestMetric)

func (*MemoryStore) UpdateCircuitBreakers

func (s *MemoryStore) UpdateCircuitBreakers(endpoints []string, services []string)

type RequestMetric

type RequestMetric struct {
	Time                int64   `json:"time"` // Unix timestamp
	Model               string  `json:"model"`
	Success             bool    `json:"success"`
	InputTokens         int64   `json:"input_tokens"`
	OutputTokens        int64   `json:"output_tokens"`
	CachedTokens        int64   `json:"cached_tokens"`
	CacheCreationTokens int64   `json:"cache_creation_tokens"`
	Cost                float64 `json:"cost"`
	Attempts            []struct {
		EndpointID string `json:"endpoint_id"`
		Success    bool   `json:"success"`
	} `json:"attempts"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL