Documentation ¶
Index ¶
- Constants
- Variables
- func AddCheckStatuses(ctx context.Context, ids []string, status models.CheckHealthStatus) error
- func Connect() (*dutyContext.Context, error)
- func CreateCanary(ctx context.Context, canary *pkg.Canary) error
- func CreateCheck(ctx context.Context, canary pkg.Canary, check *pkg.Check) error
- func DeleteCanary(ctx context.Context, id string) error
- func DeleteCheckComponentRelationshipsForCanary(db *gorm.DB, id string) error
- func DeleteChecksForCanary(db *gorm.DB, id string) ([]string, error)
- func DeleteComponentChildren(db *gorm.DB, componentID string) error
- func DeleteComponentRelationship(db *gorm.DB, componentID string) error
- func DeleteComponentsOfTopology(db *gorm.DB, topologyID string) error
- func DeleteComponentsWithIDs(db *gorm.DB, compIDs []string) error
- func DeleteInlineCanariesForComponent(db *gorm.DB, componentID string) error
- func DeleteNonTransformedChecks(db *gorm.DB, id []string) error
- func DeleteTopology(db *gorm.DB, topologyID string) error
- func FindCanary(ctx context.Context, namespace, name string) (*pkg.Canary, error)
- func FindCanaryByID(ctx context.Context, id string) (*pkg.Canary, error)
- func FindCheck(ctx context.Context, canary pkg.Canary, name string) (*pkg.Check, error)
- func FindChecks(ctx context.Context, idOrName, checkType string) ([]models.Check, error)
- func GetActiveComponentsIDsOfTopology(db *gorm.DB, topologyID string) (compIDs []uuid.UUID, err error)
- func GetAllCanariesForSync(ctx context.Context, namespace string) ([]pkg.Canary, error)
- func GetCanary(ctx context.Context, id string) (pkg.Canary, error)
- func GetCheck(ctx context.Context, id string) (*pkg.Check, error)
- func GetDB() (*sql.DB, error)
- func GetTopology(ctx context.Context, id string) (*pkg.Topology, error)
- func GetTransformedCheckIDs(ctx context.Context, canaryID string, excludeTypes ...string) ([]string, error)
- func GoOffline() error
- func Init() (dutyContext.Context, error)
- func IsConfigured() bool
- func IsConnected() bool
- func LatestCheckStatus(ctx context.Context, checkID string) (*models.CheckStatus, error)
- func PersistCanary(ctx context.Context, canary v1.Canary, source string) (*pkg.Canary, error)
- func PersistCanaryModel(ctx context.Context, model pkg.Canary) (*pkg.Canary, error)
- func PersistCheck(db *gorm.DB, check pkg.Check, canaryID uuid.UUID) (uuid.UUID, error)
- func PersistComponent(ctx context.Context, component *pkg.Component) ([]uuid.UUID, error)
- func PersistComponents(ctx context.Context, results []*pkg.Component) error
- func PersistTopology(ctx context.Context, model *pkg.Topology) (bool, error)
- func PersistV1Topology(ctx context.Context, t *v1.Topology) (pkg.Topology, bool, error)
- func PostgRESTEndpoint() string
- func RemoveTransformedChecks(ctx context.Context, ids []string) error
- func Start(ctx context.Context) error
- func StartPostgrest()
- func StopServer() error
- func SuspendCanary(ctx context.Context, id string, suspend bool) error
- func UpdateStatusAndSummaryForComponent(db *gorm.DB, id uuid.UUID, status types.ComponentStatus, summary types.Summary) (int64, error)
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.RetentionDay, 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.Retention3Day, 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 CheckStatusJobs = []*job.Job{ AggregateCheckStatues1d, AggregateCheckStatues1h, DeleteOldCheckStatues, DeleteOldCheckStatues1h, DeleteOldCheckStatues1d, RefreshCheckStatusSummary, RefreshCheckStatusSummaryAged, }
View Source
var ConnectionString string
View Source
var DBMetrics bool
View Source
var DefaultExpiryDays int
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.Retention3Day, 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.Retention3Day, 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 HTTPEndpoint = "http://localhost:8080/db"
View Source
var PostgRESTServerPort = 3000
View Source
var PostgRESTVersion = "v9.0.0"
View Source
var (
PostgresDuplicateKeyError = &pgconn.PgError{Code: "23505"}
)
View Source
var PostgresServer *embeddedpostgres.EmbeddedPostgres
View Source
var RefreshCheckStatusSummary = &job.Job{ Name: "RefreshCheckStatusSummary", Singleton: true, Timeout: 1 * time.Minute, Schedule: "@every 1m", JobHistory: true, Retention: job.Retention{ Interval: 5 * time.Minute, Success: 1, Failed: 3, Age: time.Minute * 15, }, 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{ Interval: 60 * time.Minute, Success: 1, Failed: 3, Age: time.Hour * 3, }, Singleton: true, JobHistory: true, Fn: func(ctx job.JobRuntime) error { ctx.History.ResourceType = CheckStatuses return job.RefreshCheckStatusSummaryAged(ctx.Context) }, }
View Source
var RunMigrations bool
Functions ¶
func AddCheckStatuses ¶ added in v1.0.10
func Connect ¶ added in v1.0.142
func Connect() (*dutyContext.Context, error)
func CreateCanary ¶ added in v0.38.85
func CreateCheck ¶ added in v0.38.85
func DeleteCheckComponentRelationshipsForCanary ¶ added in v0.38.151
func DeleteChecksForCanary ¶ added in v0.38.151
func DeleteComponentChildren ¶ added in v0.38.210
func DeleteComponentRelationship ¶ added in v0.38.140
func DeleteComponentsOfTopology ¶ added in v0.38.266
DeleteComponents deletes all components associated with a topology
func DeleteComponentsWithIDs ¶ added in v0.38.125
DeleteComponentsWithID deletes all components with specified ids.
func DeleteInlineCanariesForComponent ¶ added in v0.38.151
func DeleteNonTransformedChecks ¶ added in v1.0.10
func FindCanary ¶ added in v0.38.85
func FindCanaryByID ¶ added in v0.38.257
func FindChecks ¶ added in v1.0.85
func GetActiveComponentsIDsOfTopology ¶ added in v0.38.266
func GetAllCanariesForSync ¶ added in v1.0.6
func GetTopology ¶ added in v0.38.266
func GetTransformedCheckIDs ¶ added in v0.38.260
func Init ¶
func Init() (dutyContext.Context, error)
func IsConfigured ¶ added in v0.38.85
func IsConfigured() bool
func IsConnected ¶ added in v0.38.85
func IsConnected() bool
func LatestCheckStatus ¶ added in v1.0.124
func PersistCanary ¶ added in v0.38.85
func PersistCanaryModel ¶ added in v1.0.26
func PersistCheck ¶ added in v0.38.85
func PersistComponent ¶ added in v0.38.85
TODO: Simplify logic and improve readability
func PersistComponents ¶ added in v0.38.135
func PersistTopology ¶ added in v0.38.266
func PersistV1Topology ¶ added in v1.0.198
func PostgRESTEndpoint ¶ added in v0.38.137
func PostgRESTEndpoint() string
func RemoveTransformedChecks ¶ added in v1.0.10
func StartPostgrest ¶ added in v0.38.137
func StartPostgrest()
func StopServer ¶ added in v0.38.83
func StopServer() error
func SuspendCanary ¶ added in v1.0.125
SuspendCanary sets the suspend annotation on the canary table.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.