Documentation
¶
Overview ¶
Package events records and serves application timeline events: lifecycle transitions, runtime container events, and configuration changes. Events are persisted and fanned out live over the in-process event bus.
Index ¶
- func Topic(appID uint) string
- func WorkspaceTopic(workspaceID uint) string
- type Notifier
- type Recorder
- type Service
- func (s *Service) Emit(workspaceID, appID uint, t models.AppEventType, sev models.AppEventSeverity, ...)
- func (s *Service) List(appID uint, limit int, before uint) ([]models.AppEvent, error)
- func (s *Service) ListByWorkspace(workspaceID uint, order, severity string, limit, offset int) ([]models.AppEvent, int64, error)
- func (s *Service) Record(e *models.AppEvent)
- func (s *Service) SetAlertSink(n Notifier)
- func (s *Service) SetNotifier(n Notifier)
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WorkspaceTopic ¶
WorkspaceTopic carries every application event in a workspace, so one subscriber (the dashboard) can watch activity and health across all apps without subscribing per app. Mirrors the per-workspace database-status fan-out.
Types ¶
type Notifier ¶
Notifier reacts to a persisted notifiable event by triggering outbound delivery (webhooks, notification channels). Defined here so the recorder depends only on the capability; the concrete dispatcher lives in the notify package and is injected post-construction via SetNotifier.
type Recorder ¶
Recorder records application events. Implemented by Service; defined as an interface so producers (deploy worker, services, docker subscriber) depend on the capability, not the package internals.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo *repositories.AppEventRepository, bus *eventbus.Bus) *Service
func (*Service) Emit ¶
func (s *Service) Emit(workspaceID, appID uint, t models.AppEventType, sev models.AppEventSeverity, message string, meta map[string]string, actorID *uint)
Emit is a convenience constructor + Record.
func (*Service) ListByWorkspace ¶
func (s *Service) ListByWorkspace(workspaceID uint, order, severity string, limit, offset int) ([]models.AppEvent, int64, error)
ListByWorkspace returns a workspace's application events with offset pagination and the total count, ordered by order ("asc"/"desc") and optionally filtered to a single severity.
func (*Service) Record ¶
Record persists an event and publishes it live. Best-effort: a failure never propagates to the caller (recording must not break deploys or mutations).
func (*Service) SetAlertSink ¶ added in v1.6.0
SetAlertSink wires the alert engine. Unlike the outbound notifier (gated to the curated notifiable set for webhooks/channels), the sink receives EVERY recorded event — the engine needs the full signal stream (e.g. health transitions) to fire and auto-resolve alerts. Best-effort; never blocks or fails a caller.
func (*Service) SetNotifier ¶
SetNotifier wires the outbound-notification dispatcher. Optional: when unset, events are still recorded and streamed, just not delivered externally.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber translates Docker daemon container events into AppEvents. Run a single instance per process connected to the Docker daemon.
func NewSubscriber ¶
func NewSubscriber(d docker.Client, apps *repositories.ApplicationRepository, releases *repositories.ReleaseRepository, rec Recorder) *Subscriber
func (*Subscriber) Run ¶
func (s *Subscriber) Run(ctx context.Context)
Run streams engine events until ctx is cancelled, reconnecting on error.