Documentation
¶
Overview ¶
Package canary provides canary deployment capabilities for TokMan
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisConfig ¶
type AnalysisConfig struct {
Enabled bool
Interval time.Duration
SuccessfulRuns int
FailedRuns int
LookbackDuration time.Duration
ConfidenceLevel float64
}
AnalysisConfig defines automated analysis settings
type Deployment ¶
type Deployment struct {
ID string
Name string
Service string
CurrentVersion string
TargetVersion string
Status DeploymentStatus
Strategy Strategy
TrafficSplit TrafficSplit
Metrics Metrics
Analysis AnalysisConfig
RollbackConfig RollbackConfig
Phases []Phase
CurrentPhase int
// contains filtered or unexported fields
}
Deployment manages canary releases
func (*Deployment) Abort ¶
func (d *Deployment) Abort(reason string) error
Abort stops the deployment
func (*Deployment) OnEvent ¶
func (d *Deployment) OnEvent(handler EventHandler)
OnEvent registers an event handler
func (*Deployment) Rollback ¶
func (d *Deployment) Rollback() error
Rollback rolls back the deployment
type DeploymentConfig ¶
type DeploymentConfig struct {
Name string
Service string
CurrentVersion string
TargetVersion string
Strategy Strategy
Metrics Metrics
Analysis AnalysisConfig
Rollback RollbackConfig
Steps int
StepWeight float64
}
DeploymentConfig holds deployment configuration
type DeploymentStatus ¶
type DeploymentStatus string
DeploymentStatus represents the state of a deployment
const ( StatusPending DeploymentStatus = "pending" StatusRunning DeploymentStatus = "running" StatusPromoting DeploymentStatus = "promoting" StatusPromoted DeploymentStatus = "promoted" StatusRollingBack DeploymentStatus = "rolling_back" StatusRolledBack DeploymentStatus = "rolled_back" StatusFailed DeploymentStatus = "failed" StatusAborted DeploymentStatus = "aborted" )
type Event ¶
type Event struct {
Type EventType
Timestamp time.Time
Deployment string
Phase string
Message string
Data map[string]interface{}
}
Event represents a deployment event
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages canary deployments
func (*Manager) CreateDeployment ¶
func (m *Manager) CreateDeployment(config DeploymentConfig) (*Deployment, error)
CreateDeployment creates a new canary deployment
func (*Manager) GetDeployment ¶
func (m *Manager) GetDeployment(id string) (*Deployment, error)
func (*Manager) ListDeployments ¶
func (m *Manager) ListDeployments() []*Deployment
ListDeployments returns all deployments
type MetricThreshold ¶
MetricThreshold defines a threshold for a custom metric
type Metrics ¶
type Metrics struct {
ErrorRateThreshold float64
LatencyP99Threshold time.Duration
LatencyP95Threshold time.Duration
LatencyP50Threshold time.Duration
ThroughputMin float64
CustomMetrics map[string]MetricThreshold
}
Metrics holds metric thresholds for analysis
type Phase ¶
type Phase struct {
ID string
Name string
TrafficWeight float64
Duration time.Duration
Pause time.Duration
Metrics PhaseMetrics
Status PhaseStatus
StartTime time.Time
EndTime time.Time
}
Phase represents a canary phase
type PhaseMetrics ¶
type PhaseMetrics struct {
Requests int64
Errors int64
ErrorRate float64
LatencyP50 time.Duration
LatencyP95 time.Duration
LatencyP99 time.Duration
Throughput float64
}
PhaseMetrics holds metrics for a phase
type PhaseStatus ¶
type PhaseStatus string
PhaseStatus represents phase status
const ( PhaseStatusPending PhaseStatus = "pending" PhaseStatusRunning PhaseStatus = "running" PhaseStatusWaiting PhaseStatus = "waiting" PhaseStatusCompleted PhaseStatus = "completed" PhaseStatusFailed PhaseStatus = "failed" )
type RollbackConfig ¶
type RollbackConfig struct {
Enabled bool
AutoRollback bool
OnErrorRate float64
OnLatencyIncrease float64
OnMetricFailure []string
ManualApproval bool
}
RollbackConfig defines rollback behavior
type TrafficSplit ¶
TrafficSplit defines how traffic is distributed