db

package
v1.0.260-beta.219 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const CheckStatuses = "check_statuses"
View Source
const (
	DefaultTopologySchedule = "@every 10m"
)

Variables

View Source
var AggregateCheckStatues1d = &job.Job{
	Name:       "AggregateCheckStatuses1h",
	Singleton:  true,
	JobHistory: true,
	Retention:  job.RetentionBalanced,
	Schedule:   "@every 1h",
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		count, err := job.AggregateCheckStatus1h(ctx.Context)
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var AggregateCheckStatues1h = &job.Job{
	Name:       "AggregateCheckStatuses1d",
	Singleton:  true,
	JobHistory: true,
	Retention:  job.RetentionBalanced,
	Schedule:   "@every 24h",
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		count, err := job.AggregateCheckStatus1d(ctx.Context)
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var DeleteOldCheckStatues = &job.Job{
	Name:       "DeleteOldCheckStatuses",
	Singleton:  true,
	JobHistory: true,
	Schedule:   "@every 24h",
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		count, err := job.DeleteOldCheckStatuses(ctx.Context, ctx.Properties().Int("check.status.retention.days", 30))
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var DeleteOldCheckStatues1d = &job.Job{
	Name:       "DeleteOldCheckStatuses1d",
	Singleton:  true,
	JobHistory: true,
	Retention:  job.RetentionBalanced,
	Schedule:   "@every 24h",
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		count, err := job.DeleteOldCheckStatuses1d(ctx.Context, ctx.Properties().Int("check.status.retention.days", 30)*9)
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var DeleteOldCheckStatues1h = &job.Job{
	Name:       "DeleteOldCheckStatuses1h",
	Singleton:  true,
	JobHistory: true,
	Retention:  job.RetentionBalanced,
	Schedule:   "@every 24h",
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		count, err := job.DeleteOldCheckStatuses1h(ctx.Context, ctx.Properties().Int("check.status.retention.days", 30)*3)
		ctx.History.SuccessCount = count
		return err
	},
}
View Source
var (
	PostgresDuplicateKeyError = &pgconn.PgError{Code: "23505"}
)
View Source
var RefreshCheckSizeSummary = &job.Job{
	Name:       "RefreshCheckSizeSummary",
	Singleton:  true,
	Schedule:   "@every 24h",
	JobHistory: true,
	Retention:  job.RetentionFew,
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		return job.RefreshCheckSizeSummary(ctx.Context)
	},
}
View Source
var RefreshCheckStatusSummary = &job.Job{
	Name:       "RefreshCheckStatusSummary",
	Singleton:  true,
	Timeout:    1 * time.Minute,
	Schedule:   "@every 1m",
	JobHistory: true,
	Retention: job.Retention{
		Success: 1,
		Failed:  3,
	},
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		return job.RefreshCheckStatusSummary(ctx.Context)
	},
}
View Source
var RefreshCheckStatusSummaryAged = &job.Job{
	Name:     "RefreshCheckStatusSummaryAged",
	Timeout:  60 * time.Minute,
	Schedule: "@every 1h",
	Retention: job.Retention{
		Success: 1,
		Failed:  3,
	},
	Singleton:  true,
	JobHistory: true,
	Fn: func(ctx job.JobRuntime) error {
		ctx.History.ResourceType = CheckStatuses
		return job.RefreshCheckStatusSummaryAged(ctx.Context)
	},
}

Functions

func AddCheckStatuses added in v1.0.10

func AddCheckStatuses(ctx context.Context, ids []string, status models.CheckHealthStatus) error

func CreateCanary added in v0.38.85

func CreateCanary(ctx context.Context, canary *pkg.Canary) error

func CreateCheck added in v0.38.85

func CreateCheck(ctx context.Context, canary pkg.Canary, check *pkg.Check) error

func DeleteCanary added in v0.38.85

func DeleteCanary(ctx context.Context, id string) error

func DeleteCheckComponentRelationshipsForCanary added in v0.38.151

func DeleteCheckComponentRelationshipsForCanary(db *gorm.DB, id string) error

func DeleteChecksForCanary added in v0.38.151

func DeleteChecksForCanary(db *gorm.DB, id string) ([]string, error)

func DeleteComponentChildren added in v0.38.210

func DeleteComponentChildren(db *gorm.DB, componentID string) error

func DeleteComponentRelationship added in v0.38.140

func DeleteComponentRelationship(db *gorm.DB, componentID string) error

func DeleteComponentsOfTopology added in v0.38.266

func DeleteComponentsOfTopology(db *gorm.DB, topologyID string) error

DeleteComponents deletes all components associated with a topology

func DeleteComponentsWithIDs added in v0.38.125

func DeleteComponentsWithIDs(db *gorm.DB, compIDs []string) error

DeleteComponentsWithID deletes all components with specified ids.

func DeleteInlineCanariesForComponent added in v0.38.151

func DeleteInlineCanariesForComponent(db *gorm.DB, componentID string) error

func DeleteNonTransformedChecks added in v1.0.10

func DeleteNonTransformedChecks(db *gorm.DB, id []string) error

func DeleteTopology added in v0.38.266

func DeleteTopology(db *gorm.DB, topologyID string) error

func FindCanariesByWebhook

func FindCanariesByWebhook(ctx context.Context, name string) ([]pkg.Canary, error)

func FindCanary added in v0.38.85

func FindCanary(ctx context.Context, namespace, name string) (*pkg.Canary, error)

func FindCanaryByID added in v0.38.257

func FindCanaryByID(ctx context.Context, id string) (*pkg.Canary, error)

func FindCheck added in v0.38.85

func FindCheck(ctx context.Context, canary pkg.Canary, name string) (*pkg.Check, error)

func FindChecks added in v1.0.85

func FindChecks(ctx context.Context, idOrName, checkType string) ([]models.Check, error)

func GetActiveComponentsIDsOfTopology added in v0.38.266

func GetActiveComponentsIDsOfTopology(db *gorm.DB, topologyID string) (compIDs []uuid.UUID, err error)

func GetAllCanariesForSync added in v1.0.6

func GetAllCanariesForSync(ctx context.Context, namespace string) ([]pkg.Canary, error)

func GetAllValuesForConfigTag

func GetAllValuesForConfigTag(ctx context.Context, tagSelector v1.TopologyTagSelector) ([]string, error)

func GetCanary added in v0.38.85

func GetCanary(ctx context.Context, id string) (pkg.Canary, error)

func GetCheck added in v0.38.85

func GetCheck(ctx context.Context, id string) (*pkg.Check, error)

func GetTopology added in v0.38.266

func GetTopology(ctx context.Context, id string) (*pkg.Topology, error)

func GetTransformedCheckIDs added in v0.38.260

func GetTransformedCheckIDs(ctx context.Context, canaryID string, excludeTypes ...string) ([]string, error)

func LatestCheckStatus added in v1.0.124

func LatestCheckStatus(ctx context.Context, checkID string) (*models.CheckStatus, error)

func PersistCanary added in v0.38.85

func PersistCanary(ctx context.Context, canary v1.Canary, source string) (*pkg.Canary, bool, error)

func PersistCanaryModel added in v1.0.26

func PersistCanaryModel(ctx context.Context, model pkg.Canary) (*pkg.Canary, bool, error)

func PersistCheck added in v0.38.85

func PersistCheck(db *gorm.DB, check pkg.Check, canaryID uuid.UUID) (uuid.UUID, error)

func PersistComponent added in v0.38.85

func PersistComponent(ctx context.Context, component *pkg.Component) ([]uuid.UUID, error)

TODO: Simplify logic and improve readability

func PersistComponents added in v0.38.135

func PersistComponents(ctx context.Context, results []*pkg.Component) error

func PersistTopology added in v0.38.266

func PersistTopology(ctx context.Context, model *pkg.Topology) (bool, error)

func PersistV1Topology added in v1.0.198

func PersistV1Topology(ctx context.Context, t *v1.Topology) (pkg.Topology, bool, error)

func RemoveTransformedChecks added in v1.0.10

func RemoveTransformedChecks(ctx context.Context, ids []string) error

func SuspendCanary added in v1.0.125

func SuspendCanary(ctx context.Context, id string, suspend bool) error

SuspendCanary sets the suspend annotation on the canary table.

func UpdateStatusAndSummaryForComponent added in v0.38.146

func UpdateStatusAndSummaryForComponent(db *gorm.DB, id uuid.UUID, status types.ComponentStatus, summary types.Summary) (int64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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