server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package server exposes RunLore's HTTP endpoints (incident webhooks).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct {
	Approvals    *action.Approvals
	Pauser       Pauser
	Token        string
	SlackSecret  string
	WebhookToken string   // optional bearer token required on POST /webhook/alertmanager
	ApproverIDs  []string // Slack user IDs permitted to approve actions
}

Actions bundles the optional rung-2/rung-3 wiring: the approval queue, the auto kill-switch, the shared control token, and the Slack signing secret.

type Pauser

type Pauser interface {
	Pause()
	Resume()
	Paused() bool
}

Pauser is the rung-3 auto-execution kill-switch.

type Server

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

Server handles incoming incident webhooks and applies the trigger policy.

func New

func New(cfg *config.Config, enq investigate.Enqueuer, ready func() bool, acts Actions, metricsHandler http.Handler, log *slog.Logger) *Server

New builds a Server. ready reports whether this replica should serve; nil = always ready. The caller composes what readiness means (e.g. leadership AND a warm catalog). acts (optional) enables the rung-2 approval endpoints + the rung-3 kill-switch, gated by acts.Token (X-Approval-Token). /healthz is liveness; /readyz is readiness (gated by the caller-supplied ready func). metricsHandler (optional) serves OTel Prometheus metrics on GET /metrics when non-nil.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the HTTP handler (built once at construction; Go 1.22+ method routing).

func (*Server) SetCoalescer

func (s *Server) SetCoalescer(cz *coalesce.Coalescer)

SetCoalescer attaches a Coalescer after construction. Call before accepting requests; nil cz disables coalescing (direct enqueue).

func (*Server) SetMetrics

func (s *Server) SetMetrics(m *telemetry.Metrics)

SetMetrics attaches the OTel metrics instance independently of coalescing, so ingress counters (alerts_received) emit even when coalescing is disabled.

func (*Server) SetOutcomeLedger

func (s *Server) SetOutcomeLedger(l *outcome.Ledger)

SetOutcomeLedger attaches the outcome ledger; resolved alerts are recorded into it.

Jump to

Keyboard shortcuts

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