Documentation
¶
Index ¶
- type Client
- func (c *Client) CheckErrorRecoveryTime(ctx context.Context, model string) (bool, error)
- func (c *Client) CheckRecoveryTime(ctx context.Context, model string) (bool, error)
- func (c *Client) CleanupOldErrors(ctx context.Context, model string, age time.Duration) error
- func (c *Client) CleanupOldLatencies(ctx context.Context, model string, age time.Duration) error
- func (c *Client) ClearAllModelData(ctx context.Context, model string) error
- func (c *Client) Close() error
- func (c *Client) GetAverageLatency(ctx context.Context, model string, n int64) (float64, error)
- func (c *Client) GetErrorPercentages(ctx context.Context, model string, n int64) (map[int]float64, error)
- func (c *Client) GetKeysWithPrefix(ctx context.Context, prefix string) ([]string, error)
- func (c *Client) GetLatencyEntries(ctx context.Context, model string, n int64) ([]float64, error)
- func (c *Client) RecordErrorCode(ctx context.Context, model string, statusCode int) error
- func (c *Client) RecordLatency(ctx context.Context, model string, latency float64, status string) error
- func (c *Client) SetErrorRecoveryTime(ctx context.Context, model string, duration time.Duration) error
- func (c *Client) SetRecoveryTime(ctx context.Context, model string, duration time.Duration) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Redis client with our specific operations
func (*Client) CheckErrorRecoveryTime ¶ added in v0.0.21
CheckErrorRecoveryTime checks if a model is still in error recovery period
func (*Client) CheckRecoveryTime ¶
CheckRecoveryTime checks if a model is still in recovery period
func (*Client) CleanupOldErrors ¶ added in v0.0.21
CleanupOldErrors removes error entries older than the specified duration
func (*Client) CleanupOldLatencies ¶
CleanupOldLatencies removes latency entries older than the specified duration
func (*Client) ClearAllModelData ¶ added in v0.0.21
ClearAllModelData deletes all data associated with a model
func (*Client) GetAverageLatency ¶
GetAverageLatency calculates average latency for last N calls
func (*Client) GetErrorPercentages ¶ added in v0.0.21
func (c *Client) GetErrorPercentages(ctx context.Context, model string, n int64) (map[int]float64, error)
GetErrorPercentages calculates the percentage of error codes in the last N calls
func (*Client) GetKeysWithPrefix ¶ added in v0.0.23
GetKeysWithPrefix returns all Redis keys that match the given prefix pattern
func (*Client) GetLatencyEntries ¶
GetLatencyEntries retrieves the last N latency entries for a model
func (*Client) RecordErrorCode ¶ added in v0.0.21
RecordErrorCode records a model's error code with timestamp
func (*Client) RecordLatency ¶
func (c *Client) RecordLatency(ctx context.Context, model string, latency float64, status string) error
RecordLatency records a model's latency with timestamp