features

package
v0.0.0-...-7983b3b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllFeatures

type AllFeatures struct{}

AllFeatures is intended for tests and returns enabled = true for every Feature

func All

func All() *AllFeatures

All returns a Features instance with all features enabled. For tests only

func (*AllFeatures) FeatureEnabled

func (f *AllFeatures) FeatureEnabled(_ FeatureID) bool

FeatureEnabled check

type FeatureID

type FeatureID string

FeatureID type ensures well-defined list of features in this file

const (
	UpgradeToMultiMetrics  FeatureID = "upgrade-to-multi-metrics"
	IncrementalTopology    FeatureID = "incremental-topology"
	HealthStates           FeatureID = "health-states"
	ExposeKubernetesStatus FeatureID = "expose-kubernetes-status"
)

List of features managed by StackState

type Features

type Features interface {
	// FeatureEnabled is used to check whether a feature is enabled
	FeatureEnabled(feature FeatureID) bool
}

Features is used to determine whether StackState supports a certain feature or not

type FetchFeatures

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

FetchFeatures uses the StackState api to retrieve the supported feature set

func InitFeatures

func InitFeatures() *FetchFeatures

InitFeatures will call out to StackState and will intentionally wait for a response. This ensures that before any checks are run the supported feature set has been determined. The feature set will not be updated but remains fixed for the runtime of the agent. This together allows checks to not worry about changes in supported features while running and avoids potential bugs in stateful checks.

The trade-off is that an upgrade to StackState will only be recognized after an agent restart

func InitTestFeatures

func InitTestFeatures(stsClient httpclient.RetryableHTTPClient) *FetchFeatures

InitTestFeatures is for tests only and allows injecting a stub for the httpclient

func (*FetchFeatures) FeatureEnabled

func (ff *FetchFeatures) FeatureEnabled(feature FeatureID) bool

FeatureEnabled check

Jump to

Keyboard shortcuts

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