canary

package
v1.0.143 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventPushQueueCreate = "push_queue.create"
)

Variables

View Source
var (
	ReconcilePageSize int

	// Only sync data created/updated in the last ReconcileMaxAge duration
	ReconcileMaxAge time.Duration

	// UpstreamConf is the global configuration for upstream
	UpstreamConf upstream.UpstreamConfig
)
View Source
var CanaryConfigFiles []string
View Source
var CanaryScheduler = cron.New()
View Source
var CanaryStatusChannel chan CanaryStatusPayload
View Source
var DataFile string
View Source
var Executor bool
View Source
var FuncScheduler = cron.New()
View Source
var Kommons *kommons.Client
View Source
var LogPass, LogFail bool
View Source
var MinimumTimeBetweenCanaryRuns = 10 * time.Second
View Source
var PullUpstreamCanaries = job.Job{
	Name:       "PullUpstreamCanaries",
	JobHistory: true,
	Singleton:  true,
	Schedule:   "@every 10m",
	Fn: func(ctx job.JobRuntime) error {
		count, err := pull(ctx, UpstreamConf)
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var ReconcileChecks = job.Job{
	Name:       "PushChecksToUpstream",
	JobHistory: true,
	Singleton:  true,
	Schedule:   "@every 30m",
	Fn: func(ctx job.JobRuntime) error {
		reconciler := upstream.NewUpstreamReconciler(UpstreamConf, 5)
		return reconciler.SyncAfter(ctx.Context, "checks", ReconcileMaxAge)
	},
}
View Source
var SyncCheckStatuses = job.Job{
	Name:       "SyncCheckStatusesWithUpstream",
	JobHistory: true,
	Singleton:  true,
	Schedule:   "@every 1m",
	Fn: func(ctx job.JobRuntime) error {
		err, count := upstream.SyncCheckStatuses(ctx.Context, UpstreamConf, ReconcilePageSize)
		ctx.History.SuccessCount = count
		return err
	},
}

Functions

func CleanupMetricsGauges added in v0.38.328

func CleanupMetricsGauges()

CleanupMetricsGauges removes gauges for checks that no longer exist.

func DeleteCanaryJob

func DeleteCanaryJob(id string)

func ScanCanaryConfigs

func ScanCanaryConfigs()

func ScheduleFunc

func ScheduleFunc(schedule string, fn func()) (interface{}, error)

func StartScanCanaryConfigs

func StartScanCanaryConfigs(dataFile string, configFiles []string)

func StartUpstreamEventQueueConsumer added in v1.0.69

func StartUpstreamEventQueueConsumer(ctx *context.Context) error

func SyncCanaryJob

func SyncCanaryJob(ctx context.Context, dbCanary pkg.Canary, options ...SyncCanaryJobOption) error

TODO: Refactor to use database object instead of kubernetes

func SyncCanaryJobs

func SyncCanaryJobs(ctx dutyjob.JobRuntime) error

Types

type CanaryJob

type CanaryJob struct {
	Canary   v1.Canary
	DBCanary pkg.Canary
	LogPass  bool
	LogFail  bool
}

func (CanaryJob) GetNamespacedName

func (j CanaryJob) GetNamespacedName() types.NamespacedName

func (CanaryJob) Run

func (j CanaryJob) Run(ctx dutyjob.JobRuntime) error

type CanaryPullResponse added in v1.0.36

type CanaryPullResponse struct {
	Before   time.Time       `json:"before"`
	Canaries []models.Canary `json:"canaries,omitempty"`
}

type CanaryStatusPayload added in v0.38.213

type CanaryStatusPayload struct {
	Pass                 bool
	CheckStatus          map[string]*v1.CheckStatus
	FailEvents           []string
	LastTransitionedTime *metav1.Time
	Message              string
	ErrorMessage         string
	Uptime               string
	Latency              string
	NamespacedName       types.NamespacedName
}

type RelatableCheck added in v1.0.129

type RelatableCheck interface {
	GetRelationship() *v1.CheckRelationship
}

type SyncCanaryJobConfig added in v1.0.125

type SyncCanaryJobConfig struct {
	RunNow bool

	// Schedule to override the schedule from the spec
	Schedule string
}

type SyncCanaryJobOption added in v1.0.125

type SyncCanaryJobOption func(*SyncCanaryJobConfig)

func WithRunNow added in v1.0.125

func WithRunNow(value bool) SyncCanaryJobOption

func WithSchedule added in v1.0.125

func WithSchedule(schedule string) SyncCanaryJobOption

Jump to

Keyboard shortcuts

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