Documentation
¶
Index ¶
- Variables
- type AlertCallback
- type AlgorithmConfig
- type AlgorithmType
- type CacheMissConfig
- type Engine
- type ErrorConfig
- type FanoutConfig
- type LatencyConfig
- type MetricSource
- type OutlierConfig
- type PayloadConfig
- type Regression
- type RegressionFilter
- type RegressionStore
- type Severity
- type TimeWindow
- type WindowMetrics
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("regression not found")
Functions ¶
This section is empty.
Types ¶
type AlertCallback ¶
type AlertCallback func(ctx context.Context, r Regression)
AlertCallback is called when a regression is detected or resolved. It is defined here to avoid an import cycle with the incident package.
type AlgorithmConfig ¶
type AlgorithmConfig struct {
LatencyRegression LatencyConfig `yaml:"latency_regression" json:"latency_regression"`
ErrorRate ErrorConfig `yaml:"error_rate" json:"error_rate"`
TenantOutlier OutlierConfig `yaml:"tenant_outlier" json:"tenant_outlier"`
CacheMiss CacheMissConfig `yaml:"cache_miss" json:"cache_miss"`
DBFanout FanoutConfig `yaml:"db_fanout" json:"db_fanout"`
PayloadGrowth PayloadConfig `yaml:"payload_growth" json:"payload_growth"`
}
Algorithm configs
func DefaultAlgorithmConfig ¶
func DefaultAlgorithmConfig() AlgorithmConfig
type AlgorithmType ¶
type AlgorithmType string
const ( AlgoLatencyRegression AlgorithmType = "latency_regression" AlgoErrorRate AlgorithmType = "error_rate" AlgoTenantOutlier AlgorithmType = "tenant_outlier" AlgoCacheMiss AlgorithmType = "cache_miss" AlgoDBFanout AlgorithmType = "db_fanout" AlgoPayloadGrowth AlgorithmType = "payload_growth" )
type CacheMissConfig ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates continuous regression detection and deploy-triggered evaluation.
func New ¶
func New(source MetricSource, store RegressionStore, deploys dataplane.ConfigStore, cfg AlgorithmConfig, interval, window time.Duration) *Engine
New creates a new regression detection engine.
func (*Engine) OnDeploy ¶
func (e *Engine) OnDeploy(deploy dataplane.DeployEvent)
OnDeploy enqueues a deploy event for evaluation at predefined intervals.
func (*Engine) SetAlertCallback ¶
func (e *Engine) SetAlertCallback(fn AlertCallback)
SetAlertCallback registers a callback that is invoked whenever a regression is saved or resolved. The callback is optional; nil disables alerting.
func (*Engine) Stop ¶
func (e *Engine) Stop()
Stop signals the engine to shut down and waits for goroutines to finish.
func (*Engine) Store ¶
func (e *Engine) Store() RegressionStore
Store exposes the regression store for API handlers.
type ErrorConfig ¶
type FanoutConfig ¶
type LatencyConfig ¶
type MetricSource ¶
type MetricSource interface {
WindowMetrics(ctx context.Context, service, action string, window TimeWindow) (*WindowMetrics, error)
TenantWindowMetrics(ctx context.Context, service, tenantID string, window TimeWindow) (*WindowMetrics, error)
FleetWindowMetrics(ctx context.Context, service string, window TimeWindow) (*WindowMetrics, error)
ListServices(ctx context.Context) ([]string, error)
ListTenants(ctx context.Context, service string) ([]string, error)
}
func NewMetricSource ¶
func NewMetricSource(prom promv1.API, db *sql.DB) MetricSource
NewMetricSource returns a MetricSource backed by Prometheus (for latency/error/count aggregates) and DuckDB (for cache miss, fanout, and payload metrics derived from spans).
type OutlierConfig ¶
type PayloadConfig ¶
type Regression ¶
type Regression struct {
ID string
Algorithm AlgorithmType
Severity Severity
Confidence int
Service string
Action string
DeployID string
TenantID string
Title string
BeforeValue float64
AfterValue float64
ChangePercent float64
SampleSize int64
DetectedAt time.Time
WindowBefore TimeWindow
WindowAfter TimeWindow
Status string // "active", "resolved", "dismissed"
ResolvedAt *time.Time
}
type RegressionFilter ¶
type RegressionStore ¶
type RegressionStore interface {
Save(ctx context.Context, r *Regression) error
List(ctx context.Context, filter RegressionFilter) ([]Regression, error)
Get(ctx context.Context, id string) (*Regression, error)
UpdateStatus(ctx context.Context, id string, status string) error
ActiveForDeploy(ctx context.Context, deployID string) ([]Regression, error)
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dynamostore implements regression.RegressionStore backed by DynamoDB via the generic dynamostore package.
|
Package dynamostore implements regression.RegressionStore backed by DynamoDB via the generic dynamostore package. |