Help us shape the future of Go! Take the 2026 Go Developer Survey

features

package
v0.315.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API                       = "api"
	OTLPReceiver              = "otlp_receiver"
	Prometheus                = "prometheus"
	PromQL                    = "promql"
	PromQLFunctions           = "promql_functions"
	PromQLOperators           = "promql_operators"
	Rules                     = "rules"
	Scrape                    = "scrape"
	ServiceDiscoveryProviders = "service_discovery_providers"
	TemplatingFunctions       = "templating_functions"
	TSDB                      = "tsdb"
	UI                        = "ui"
)

Category constants define the standard feature flag categories used in Prometheus.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the package-level registry used by Prometheus.

Functions

func Disable

func Disable(category, name string)

Disable marks a feature as disabled in the default registry.

func Enable

func Enable(category, name string)

Enable marks a feature as enabled in the default registry.

func Get

func Get() map[string]map[string]bool

Get returns all features from the default registry.

func Set

func Set(category, name string, enabled bool)

Set sets a feature to the specified enabled state in the default registry.

Types

type Collector

type Collector interface {
	// Enable marks a feature as enabled in the registry.
	// The category and name should use snake_case naming convention.
	Enable(category, name string)

	// Disable marks a feature as disabled in the registry.
	// The category and name should use snake_case naming convention.
	Disable(category, name string)

	// Set sets a feature to the specified enabled state.
	// The category and name should use snake_case naming convention.
	Set(category, name string, enabled bool)

	// Get returns a copy of all registered features organized by category.
	// Returns a map where the keys are category names and values are maps
	// of feature names to their enabled status.
	Get() map[string]map[string]bool
}

Collector defines the interface for collecting and managing feature flags. It provides methods to enable, disable, and retrieve feature states.

func NewRegistry

func NewRegistry() Collector

NewRegistry creates a new feature registry.

Jump to

Keyboard shortcuts

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