monitor

package
v1.16.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

README

pkg/monitor

pkg/monitor is the polling monitor framework for region.

Unlike handlers and managers, this layer is not driving desired-state reconciliation directly. It periodically inspects live provider-backed resource state and projects that back into:

  • Kubernetes status updates
  • structured transition logs
  • OpenTelemetry metrics

Architecturally, this is important because it is a cross-resource, potentially cross-repo pattern rather than a one-off local helper. It is where the platform admits that some lifecycle truth must be polled and observed, not only pushed by controller watches.

Current Shape

  • builds a shared provider registry
  • creates OTel instruments
  • runs one or more Checkers on a poll interval
  • logs and continues on non-fatal per-check failures

Right now the only checker is health/server, but the abstraction is clearly intended to allow additional monitor classes later.

Caveats

  • This is polling by design. That makes it simpler and more decoupled, but also means timeliness and overhead are governed by poll period rather than watches.
  • Provider/cache readiness is part of monitor startup.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, c client.Client, o *Options) error

Run sits in an infinite loop, polling every so often. It returns an error if initialisation fails; a nil return means the context was cancelled and the monitor shut down cleanly.

Types

type Checker

type Checker interface {
	// Check does whatever the checker is checking for.
	Check(ctx context.Context) error
}

Checker is an interface that monitors must implement.

type Options

type Options struct {
	// CoreOptions provides --namespace, --otlp-endpoint, logging, and OTel setup.
	CoreOptions options.CoreOptions
	// contains filtered or unexported fields
}

Options allow modification of parameters via the CLI.

func (*Options) AddFlags

func (o *Options) AddFlags(flags *pflag.FlagSet)

AddFlags registers option flags with pflag.

Directories

Path Synopsis
health

Jump to

Keyboard shortcuts

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