service

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.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 HeartbeatSummary

type HeartbeatSummary struct {
	ID               string   `json:"id"`
	Title            string   `json:"title,omitempty"`
	Status           string   `json:"status"`
	Interval         string   `json:"interval,omitempty"`
	IntervalSeconds  int64    `json:"intervalSeconds,omitempty"`
	LateAfter        string   `json:"lateAfter,omitempty"`
	LateAfterSeconds int64    `json:"lateAfterSeconds,omitempty"`
	LastBump         string   `json:"lastBump,omitempty"`
	Receivers        []string `json:"receivers,omitempty"`
	URL              string   `json:"url,omitempty"`
	HasHistory       bool     `json:"hasHistory,omitempty"`
}

HeartbeatSummary represents a UI-friendly heartbeat payload.

type ReceiverStore

type ReceiverStore interface {
	Receivers() []*kit.Receiver
}

ReceiverStore provides receiver configuration access.

type ReceiverSummary

type ReceiverSummary struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Destination string `json:"destination"`
	LastSent    string `json:"lastSent,omitempty"`
	LastErr     string `json:"lastErr,omitempty"`
}

ReceiverSummary represents a UI-friendly receiver payload.

type Service

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

func NewService

func NewService(manager Store, receivers ReceiverStore, historyStore history.Recorder, metricsReg *metrics.Registry) *Service

NewService constructs a Service from a Manager.

func (*Service) HeartbeatSummaries

func (s *Service) HeartbeatSummaries() []HeartbeatSummary

HeartbeatSummaries returns a summary list for the UI.

func (*Service) HeartbeatSummaryByID

func (s *Service) HeartbeatSummaryByID(id string) (HeartbeatSummary, bool)

HeartbeatSummaryByID returns a heartbeat summary for a given id.

func (*Service) HistorySnapshot

func (s *Service) HistorySnapshot() []history.Event

HistorySnapshot returns all history events.

func (*Service) HistoryStream

func (s *Service) HistoryStream(buffer int) (<-chan history.Event, func())

HistoryStream subscribes to history events when supported.

func (*Service) ReceiverSummaries

func (s *Service) ReceiverSummaries() []ReceiverSummary

ReceiverSummaries returns a summary list for the UI.

func (*Service) ReceiverSummaryByKey

func (s *Service) ReceiverSummaryByKey(receiver, targetTypeName, target string) (ReceiverSummary, bool)

ReceiverSummaryByKey returns a receiver summary by receiver/type/target.

func (*Service) StatusAll

func (s *Service) StatusAll() []Status

StatusAll returns a status list for all heartbeats.

func (*Service) StatusByID

func (s *Service) StatusByID(id string) (Status, error)

StatusByID returns the status for a heartbeat.

func (*Service) Update

func (s *Service) Update(id string, payload string, now time.Time) error

Update records a new heartbeat payload for the given id.

type Status

type Status struct {
	ID        string        `json:"id"`              // Heartbeat identifier.
	LastSeen  time.Time     `json:"last_seen"`       // Last received heartbeat time.
	Stage     runner.Stage  `json:"stage"`           // Current stage.
	LateAfter time.Duration `json:"lateAfter"`       // Late window duration.
	Interval  time.Duration `json:"interval"`        // Expected interval.
	SinceSeen time.Duration `json:"since_last_seen"` // Time since last heartbeat.
}

Status is the public heartbeat state payload.

type Store

type Store interface {
	Get(id string) (*htypes.Heartbeat, bool)
	All() []*htypes.Heartbeat
}

Service provides heartbeat updates and status snapshots. Store exposes read access to heartbeat state.

Jump to

Keyboard shortcuts

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