agent

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProcessBusy = errors.New("another process run is already in progress")

ErrProcessBusy is returned by a Worker's ProcessServices/ProcessEndpoint when another run already holds the serialization lock, so the caller knows the work was skipped (not completed) and should be retried.

Functions

func DBNotificationThread

func DBNotificationThread(ctx context.Context, w Worker)

func NewGoCronLogger

func NewGoCronLogger() gocron.Logger

func NewScheduler

func NewScheduler() gocron.Scheduler

func RegisterAgent

func RegisterAgent(pool db.PgxIface, provider string)

func ScheduleProcessServices added in v2.5.4

func ScheduleProcessServices(ctx context.Context, w Worker) error

ScheduleProcessServices enqueues a ProcessServices run that reschedules itself on failure or advisory-lock contention, so a busy-skipped run is re-driven promptly rather than at the next sync interval. The scheduler is taken from the Worker, so both the notification handler and PendingSyncLoop share it.

Enqueues are coalesced when the Worker provides a *Coalescer via ProcessServicesCoalescer(): a burst of signals collapses to at most one queued run, with exactly one follow-up run if a signal arrives while one is executing.

func UpdateHeartbeat

func UpdateHeartbeat(pool db.PgxIface)

UpdateHeartbeat updates the agent's heartbeat timestamp in the database. This should be called periodically to indicate the agent is still alive.

Types

type Coalescer added in v2.5.4

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

Coalescer collapses a burst of ProcessServices enqueue signals into at most one queued run, guaranteeing that a signal arriving while a run executes triggers exactly one follow-up run. The zero value is ready to use.

type DebugMonitor

type DebugMonitor struct{}

func (*DebugMonitor) IncrementJob

func (d *DebugMonitor) IncrementJob(id uuid.UUID, name string, tags []string, status gocron.JobStatus)

func (*DebugMonitor) RecordJobTiming

func (d *DebugMonitor) RecordJobTiming(startTime, endTime time.Time, id uuid.UUID, name string, tags []string)

func (*DebugMonitor) RecordJobTimingWithStatus

func (d *DebugMonitor) RecordJobTimingWithStatus(startTime, endTime time.Time, id uuid.UUID, name string, tags []string, status gocron.JobStatus, err error)

type PrometheusListener

type PrometheusListener struct {
	*http.Server
}

func NewPrometheusListener

func NewPrometheusListener() *PrometheusListener

func (*PrometheusListener) Run

func (pl *PrometheusListener) Run()

type PrometheusMonitor

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

func NewPrometheusMonitor

func NewPrometheusMonitor() *PrometheusMonitor

func (PrometheusMonitor) IncrementJob

func (p PrometheusMonitor) IncrementJob(_ uuid.UUID, name string, tags []string, status gocron.JobStatus)

func (PrometheusMonitor) RecordJobTiming

func (p PrometheusMonitor) RecordJobTiming(startTime, endTime time.Time, _ uuid.UUID, name string, tags []string)

type Worker

type Worker interface {
	ProcessServices(context.Context) error
	ProcessEndpoint(context.Context, strfmt.UUID) error
	GetPool() db.PgxIface
	GetScheduler() gocron.Scheduler
}

Directories

Path Synopsis
f5
as3
ni

Jump to

Keyboard shortcuts

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