events

package
v1.6.2 Latest Latest
Warning

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

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

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Topic

func Topic(appID uint) string

Topic is the event-bus topic carrying an application's live events.

func WorkspaceTopic

func WorkspaceTopic(workspaceID uint) string

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

type Notifier interface {
	OnEvent(e *models.AppEvent)
}

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

type Recorder interface {
	Record(e *models.AppEvent)
}

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) List

func (s *Service) List(appID uint, limit int, before uint) ([]models.AppEvent, error)

List returns an application's events newest-first (cursor via before).

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

func (s *Service) Record(e *models.AppEvent)

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

func (s *Service) SetAlertSink(n Notifier)

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

func (s *Service) SetNotifier(n Notifier)

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 (*Subscriber) Run

func (s *Subscriber) Run(ctx context.Context)

Run streams engine events until ctx is cancelled, reconnecting on error.

Jump to

Keyboard shortcuts

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