alert

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertEvent

type AlertEvent struct {
	IncidentID uuid.UUID
	Type       AlertType
	MonitorID  uuid.UUID
	TeamID     uuid.UUID
	MonitorURL string
	AlertEmail string
	Reason     string
	StatusCode int
	LatencyMs  int64
	CheckedAt  time.Time
}

type AlertService

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

func NewAlertService

func NewAlertService(
	alertConfig *config.AlertConfig,
	db *pgxpool.Pool,
	pluginRepo PluginConfigGetter,
	redisCache PluginCacheClient,
	alertChan chan AlertEvent,
	logger *zerolog.Logger,
) *AlertService

func (*AlertService) Start

func (s *AlertService) Start()

func (*AlertService) WorkerClosingWait

func (s *AlertService) WorkerClosingWait()

type AlertType

type AlertType string
const (
	AlertTypeDown      AlertType = "DOWN"
	AlertTypeRecovered AlertType = "RECOVERED"
)

type PluginCacheClient added in v0.1.9

type PluginCacheClient interface {
	GetCachedResendConfig(ctx context.Context, teamID uuid.UUID) (ResendEmailConfig, bool)
	SetCachedResendConfig(ctx context.Context, teamID uuid.UUID, cfg ResendEmailConfig, ttl time.Duration) error
	GetCachedZendutyConfig(ctx context.Context, teamID uuid.UUID) (ZendutyConfig, bool)
	SetCachedZendutyConfig(ctx context.Context, teamID uuid.UUID, cfg ZendutyConfig, ttl time.Duration) error
}

PluginCacheClient is satisfied by *redis.Client.

type PluginConfigGetter added in v0.1.9

type PluginConfigGetter interface {
	GetResendConfig(ctx context.Context, teamID uuid.UUID) (ResendEmailConfig, bool, error)
	GetZendutyConfig(ctx context.Context, teamID uuid.UUID) (ZendutyConfig, bool, error)
}

PluginConfigGetter is satisfied by *plugin.Repository. Defined here to avoid importing the plugin package from alert.

type ResendEmailConfig added in v0.1.9

type ResendEmailConfig struct {
	APIKey      string
	SenderEmail string
}

ResendEmailConfig holds only what the alert service needs from a Resend plugin.

type ZendutyConfig added in v0.1.9

type ZendutyConfig struct {
	IntegrationURL string `json:"integration_url"`
}

ZendutyConfig holds what the alert service needs from a Zenduty plugin.

Jump to

Keyboard shortcuts

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