Documentation
¶
Index ¶
- func AddRequest(ctx context.Context, model string, channelID int64, isError, tryBan bool) (beyondThreshold bool, banExecution bool, err error)
- func ClearAllModelErrors(ctx context.Context) error
- func ClearChannelAllModelErrors(ctx context.Context, channelID int) error
- func ClearChannelModelErrors(ctx context.Context, model string, channelID int) error
- func GetAllBannedModelChannels(ctx context.Context) (map[string][]int64, error)
- func GetAllChannelModelErrorRates(ctx context.Context) (map[int64]map[string]float64, error)
- func GetBannedChannelsWithModel(ctx context.Context, model string) ([]int64, error)
- func GetChannelModelErrorRates(ctx context.Context, channelID int64) (map[string]float64, error)
- func GetModelChannelErrorRate(ctx context.Context, model string) (map[int64]float64, error)
- func GetModelsErrorRate(ctx context.Context) (map[string]float64, error)
- type ChannelStats
- type MemModelMonitor
- func (m *MemModelMonitor) AddRequest(model string, channelID int64, isError, tryBan bool) (beyondThreshold, banExecution bool)
- func (m *MemModelMonitor) ClearAllModelErrors(_ context.Context) error
- func (m *MemModelMonitor) ClearChannelAllModelErrors(_ context.Context, channelID int) error
- func (m *MemModelMonitor) ClearChannelModelErrors(_ context.Context, model string, channelID int) error
- func (m *MemModelMonitor) GetAllBannedModelChannels(_ context.Context) (map[string][]int64, error)
- func (m *MemModelMonitor) GetAllChannelModelErrorRates(_ context.Context) (map[int64]map[string]float64, error)
- func (m *MemModelMonitor) GetBannedChannelsWithModel(_ context.Context, model string) ([]int64, error)
- func (m *MemModelMonitor) GetChannelModelErrorRates(_ context.Context, channelID int64) (map[string]float64, error)
- func (m *MemModelMonitor) GetModelChannelErrorRate(_ context.Context, model string) (map[int64]float64, error)
- func (m *MemModelMonitor) GetModelsErrorRate(_ context.Context) (map[string]float64, error)
- type ModelData
- type TimeWindowStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRequest ¶
func AddRequest(ctx context.Context, model string, channelID int64, isError, tryBan bool) (beyondThreshold bool, banExecution bool, err error)
AddRequest adds a request record and checks if channel should be banned
func ClearAllModelErrors ¶
ClearAllModelErrors clears all error records
func ClearChannelAllModelErrors ¶
ClearChannelAllModelErrors clears all errors for a specific channel
func ClearChannelModelErrors ¶
ClearChannelModelErrors clears errors for a specific channel and model
func GetAllBannedModelChannels ¶
GetAllBannedModelChannels gets all banned channels for all models
func GetAllChannelModelErrorRates ¶
GetAllChannelModelErrorRates gets error rates for all channels and models
func GetBannedChannelsWithModel ¶
GetBannedChannelsWithModel gets banned channels for a specific model
func GetChannelModelErrorRates ¶
GetChannelModelErrorRates gets error rates for a specific channel
Types ¶
type ChannelStats ¶
type ChannelStats struct {
// contains filtered or unexported fields
}
type MemModelMonitor ¶
type MemModelMonitor struct {
// contains filtered or unexported fields
}
func NewMemModelMonitor ¶
func NewMemModelMonitor() *MemModelMonitor
func (*MemModelMonitor) AddRequest ¶
func (m *MemModelMonitor) AddRequest(model string, channelID int64, isError, tryBan bool) (beyondThreshold, banExecution bool)
func (*MemModelMonitor) ClearAllModelErrors ¶
func (m *MemModelMonitor) ClearAllModelErrors(_ context.Context) error
func (*MemModelMonitor) ClearChannelAllModelErrors ¶
func (m *MemModelMonitor) ClearChannelAllModelErrors(_ context.Context, channelID int) error
func (*MemModelMonitor) ClearChannelModelErrors ¶
func (*MemModelMonitor) GetAllBannedModelChannels ¶
func (*MemModelMonitor) GetAllChannelModelErrorRates ¶
func (*MemModelMonitor) GetBannedChannelsWithModel ¶
func (*MemModelMonitor) GetChannelModelErrorRates ¶
func (*MemModelMonitor) GetModelChannelErrorRate ¶
func (*MemModelMonitor) GetModelsErrorRate ¶
type TimeWindowStats ¶
type TimeWindowStats struct {
// contains filtered or unexported fields
}
func NewTimeWindowStats ¶
func NewTimeWindowStats() *TimeWindowStats
func (*TimeWindowStats) AddRequest ¶
func (t *TimeWindowStats) AddRequest(now time.Time, isError bool)
func (*TimeWindowStats) GetStats ¶
func (t *TimeWindowStats) GetStats() (totalReq, totalErr int)
func (*TimeWindowStats) HasValidSlices ¶
func (t *TimeWindowStats) HasValidSlices() bool
Click to show internal directories.
Click to hide internal directories.