hive

package
v1.17.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 24 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShutdownWithError = upstream.ShutdownWithError
)

Functions

func AddConfigOverride

func AddConfigOverride[Cfg cell.Flagger](h *Hive, override func(*Cfg))

func NewStateDBMetricsImpl

func NewStateDBMetricsImpl(m StateDBMetrics) statedb.Metrics

func NewStateDBReconcilerMetricsImpl

func NewStateDBReconcilerMetricsImpl(m ReconcilerMetrics) reconciler.Metrics

Types

type Hive

type Hive = upstream.Hive

func New

func New(cells ...cell.Cell) *Hive

New wraps the hive.New to create a hive with defaults used by cilium-agent. pkg/hive should eventually go away and this code should live in e.g. daemon/cmd or operator/cmd.

type OnDemand

type OnDemand[Resource any] interface {
	// Acquire a resource. On the first call to Acquire() the underlying
	// resource is started with the provided context that aborts the start
	// if the context is cancelled. On failure to start the resulting error
	// is returned.
	Acquire(context.Context) (Resource, error)

	// Release a resource. When the last acquired reference to the resource
	// is released the resource is stopped. If stopping the resource fails
	// the error is returned.
	Release(resource Resource) error
}

OnDemand provides access to a resource on-demand. On first call to Acquire() the resource is started (cell.Lifecycle.Start). If the starting of the resource fails Acquire() returns the error from Start(). When all references are Release()'d the resource is stopped (cell.Lifecycle.Stop), and again failure from Stop() is returned.

func NewOnDemand

func NewOnDemand[Resource any](log *slog.Logger, resource Resource, hook cell.HookInterface) OnDemand[Resource]

NewOnDemand wraps a resource that will be started and stopped on-demand. The resource and the lifecycle hooks are provided separately, but can of course be the same thing. They're separate to support the use-case where the resource is a state object (e.g. StateDB table) and the hook is a job group that populates the object.

func NewStaticOnDemand

func NewStaticOnDemand[Resource any](resource Resource) OnDemand[Resource]

NewStaticOnDemand creates an on-demand resource that is "static", i.e. always running and not started or stopped.

type Options added in v1.16.0

type Options = upstream.Options

type ReconcilerMetrics added in v1.16.0

type ReconcilerMetrics struct {
	ReconciliationCount         metric.Vec[metric.Counter]
	ReconciliationDuration      metric.Vec[metric.Observer]
	ReconciliationTotalErrors   metric.Vec[metric.Counter]
	ReconciliationCurrentErrors metric.Vec[metric.Gauge]

	PruneCount       metric.Vec[metric.Counter]
	PruneTotalErrors metric.Vec[metric.Counter]
	PruneDuration    metric.Vec[metric.Observer]
}

func NewStateDBReconcilerMetrics added in v1.16.0

func NewStateDBReconcilerMetrics() ReconcilerMetrics

type Shutdowner

type Shutdowner = upstream.Shutdowner

type StateDBMetrics added in v1.16.0

type StateDBMetrics struct {
	// How long a read transaction was held.
	WriteTxnDuration metric.Vec[metric.Observer]
	// How long it took to acquire a write transaction for all tables.
	WriteTxnAcquisition metric.Vec[metric.Observer]
	// How long writers were blocked while waiting to acquire a write transaction for a specific table.
	TableContention metric.Vec[metric.Gauge]
	// The amount of objects in a given table.
	TableObjectCount metric.Vec[metric.Gauge]
	// The current revision of a given table.
	TableRevision metric.Vec[metric.Gauge]
	// The amount of delete trackers for a given table.
	TableDeleteTrackerCount metric.Vec[metric.Gauge]
	// The amount of objects in the graveyard for a given table.
	TableGraveyardObjectCount metric.Vec[metric.Gauge]
	// The lowest revision of a given table that has been processed by the graveyard garbage collector.
	TableGraveyardLowWatermark metric.Vec[metric.Gauge]
	// The time it took to clean the graveyard for a given table.
	TableGraveyardCleaningDuration metric.Vec[metric.Observer]
}

func NewStateDBMetrics added in v1.16.0

func NewStateDBMetrics() StateDBMetrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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