oracle-watchdog

monitor

import "github.com/afreidah/oracle-watchdog/internal/monitor"

Index

type Monitor

Monitor maintains a Consul session heartbeat for an Oracle node and optionally drives the WireGuard endpoint resolver alongside it.

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

func New

func New(nodeName string, opts ...Option) *Monitor

New creates a Monitor for the given node name. Connection to Consul happens asynchronously in Run.

func (*Monitor) Run

func (m *Monitor) Run(ctx context.Context) error

Run starts the monitor loop. Never returns an error due to Consul issues - continuously retries and emits metrics. Only returns on context cancellation. When the WireGuard resolver is enabled, it runs as a sibling goroutine sharing the same context lifetime.

type Option

Option configures the Monitor. Used to enable optional features without changing the New signature for existing callers.

type Option func(*Monitor)

func WithWireguard

func WithWireguard(cfg config.WireguardConfig) Option

WithWireguard attaches a WireGuard endpoint resolver configuration. The resolver only runs when cfg.Enabled is true.

Generated by gomarkdoc