controller

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MetricSubsystem = "controller"

Variables

View Source
var (
	// No Subsystem.
	MetricSourceUp = metrics.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "source_up",
		},
		[]string{"source"},
	)
	MetricProviderUp = metrics.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "provider_up",
		},
		[]string{"provider"},
	)
	MetricEndpoints = metrics.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "endpoints",
		},
		[]string{"source"},
	)
	// Controller Subsystem.
	MetricRuns = metrics.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: MetricSubsystem,
			Name:      "runs",
		},
		[]string{"status"},
	)
	MetricLastRunTimestamp = metrics.NewGauge(
		prometheus.GaugeOpts{
			Subsystem: MetricSubsystem,
			Name:      "last_run_timestamp",
		},
	)
	MetricLastRunDurationSeconds = metrics.NewGauge(
		prometheus.GaugeOpts{
			Subsystem: MetricSubsystem,
			Name:      "last_run_duration_seconds",
		},
	)
	MetricRunDurationSeconds = metrics.NewHistogram(
		prometheus.HistogramOpts{
			Subsystem: MetricSubsystem,
			Name:      "run_duration_seconds",
		},
	)
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Sources   []source.NamedSource
	Providers []provider.NamedProvider
	// The interval between individual synchronizations
	Interval time.Duration
	// Logger instance
	Logger *zap.Logger
	// contains filtered or unexported fields
}

func (*Controller) Run

func (c *Controller) Run(ctx context.Context)

Run runs RunOnce in a loop with a delay until context is canceled.

func (*Controller) RunOnce

func (c *Controller) RunOnce(ctx context.Context) error

RunOnce runs a single iteration of a reconciliation loop.

func (*Controller) ScheduleRunOnce

func (c *Controller) ScheduleRunOnce(now time.Time)

ScheduleRunOnce makes sure execution happens at most once per interval.

func (*Controller) ShouldRunOnce

func (c *Controller) ShouldRunOnce(now time.Time) bool

Jump to

Keyboard shortcuts

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