systemstatus

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package systemstatus reads the System status (C-19.FR-10): the live replicas with the Leader and their key ids, the recovery state, the delivery queues, the Broken Destinations, the Integrations that need attention, the template errors, the active Storms and the result of the last outgoing heartbeat. Any replica answers it; it changes nothing.

Index

Constants

View Source
const (
	IssueHeartbeatLost     = "heartbeat_lost"
	IssueSnapshotTruncated = "snapshot_truncated"
)

The issues of an Integration that needs attention.

View Source
const (
	SubjectRoute       = "route"
	SubjectDestination = "destination"
)

The kinds of the subject of a template error.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokenDestination

type BrokenDestination struct {
	Destination Entity
	Since       time.Time
	Reason      string
}

BrokenDestination is a Broken Destination with the masked reason.

type Config

type Config struct {
	OrgID   int64
	Queries Queries
	// Replicas lists the live replicas, those whose record is younger than replica.live_expiry on the real clock.
	Replicas func(ctx context.Context) ([]keyring.Replica, error)
	// Business is the business clock: the recovery window, the alive mark and the due Thread replies follow it.
	Business clock.Clock
	// LeaderAbsence is leader.absence_notice: a Leader whose alive mark is older is not flagged.
	LeaderAbsence time.Duration
	// Version and Commit are those of the binary.
	Version, Commit string
}

Config is what the Service reads.

type Entity

type Entity struct {
	ID   string
	Name string
}

Entity names a configuration entity by its public_id and its current name.

type IntegrationAttention

type IntegrationAttention struct {
	Integration Entity
	Issue       string
	Since       *time.Time
}

IntegrationAttention is an Integration that is Heartbeat lost or has a truncated groupKey.

type OutgoingHeartbeat

type OutgoingHeartbeat struct {
	Configured     bool
	LastAttemptAt  *time.Time
	LastOK         *bool
	LastError      *string
	LastErrorClass string
	LastStatus     int
}

OutgoingHeartbeat is the result of the last outgoing heartbeat; without a URL nothing else is set. A failed one has the class of its error and the status code of the answer, 0 without one (outgoingheartbeat.FailureOf).

type Queries

type Queries interface {
	GetRuntimeState(ctx context.Context) (dbgen.GetRuntimeStateRow, error)
	LatestDowntime(ctx context.Context) (dbgen.LatestDowntimeRow, error)
	ListDeliveryQueues(ctx context.Context, arg dbgen.ListDeliveryQueuesParams) ([]dbgen.ListDeliveryQueuesRow, error)
	ListBrokenDestinations(ctx context.Context, orgID int64) ([]dbgen.ListBrokenDestinationsRow, error)
	ListIntegrationsAttention(ctx context.Context, orgID int64) ([]dbgen.ListIntegrationsAttentionRow, error)
	ListTemplateErrors(ctx context.Context, orgID int64) ([]dbgen.ListTemplateErrorsRow, error)
	ListActiveStorms(ctx context.Context, orgID int64) ([]dbgen.ListActiveStormsRow, error)
	GetOutgoingHeartbeatResult(ctx context.Context, orgID int64) (dbgen.GetOutgoingHeartbeatResultRow, error)
}

Queries are the reads of the System status; *dbgen.Queries implements them.

func NewQueries

func NewQueries(d dbgen.DBTX) Queries

NewQueries is the Queries over a pool, a connection or a transaction.

type Queue

type Queue struct {
	Destination Entity
	Queued      int64
}

Queue is a Destination with deliveries waiting.

type Recovery

type Recovery struct {
	Active     bool
	PeriodFrom *time.Time
	PeriodTo   *time.Time
	Until      *time.Time
}

Recovery is the recovery state after downtime: Active while the recovery window lasts, Until its end while it is active, and the last downtime, when there was one.

type Replica

type Replica struct {
	ID          string
	Leader      bool
	KeyIDs      []string
	RefreshedAt time.Time
}

Replica is a live replica; Leader flags the one that leads, with a fresh alive mark.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service reads the System status of the Organization.

func New

func New(cfg Config) *Service

New returns the Service of cfg.

func (*Service) Get

func (s *Service) Get(ctx context.Context) (Status, error)

Get reads the System status.

type Status

type Status struct {
	Version               string
	Commit                string
	Replicas              []Replica
	Recovery              Recovery
	DeliveryQueues        []Queue
	BrokenDestinations    []BrokenDestination
	IntegrationsAttention []IntegrationAttention
	TemplateErrors        []TemplateError
	ActiveStorms          []Storm
	OutgoingHeartbeat     OutgoingHeartbeat
}

Status is the System status.

type Storm

type Storm struct {
	Route           Entity
	Since           time.Time
	AlertGroupCount int64
}

Storm is an active Storm of a Route.

type TemplateError

type TemplateError struct {
	SubjectKind string
	Subject     Entity
	Template    string
	Since       time.Time
	Error       string
}

TemplateError is a Route or a Destination whose template keeps failing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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