manager.go - Overview
-
Overview This file defines the
FeatureManager
struct and its methods for managing feature flags in the SigNoz query service. It includes functionalities to check, retrieve, initialize, and update feature flags. -
Detailed Documentation
FeatureManager
- Purpose: Manages feature flags, determining whether specific features are active or inactive.
type FeatureManager struct {
}
StartManager
- Purpose: Creates and returns a new instance of
FeatureManager
. - Returns: A pointer to a
FeatureManager
instance (*FeatureManager
).
func StartManager() *FeatureManager
CheckFeature
- Purpose: Checks if a feature associated with the given key is active.
- Parameters:
featureKey
(string): The key identifying the feature to check.
- Returns:
error
: Returnsnil
if the feature is active. Returnsmodel.ErrFeatureUnavailable
if the feature is inactive or not found.
func (fm *FeatureManager) CheckFeature(featureKey string) error
GetFeatureFlags
- Purpose: Retrieves the current set of features.
- Returns:
model.FeatureSet
: A slice ofmodel.Feature
representing the available features. Includes default features and the OSS feature.error
: Returnsnil
if successful.
func (fm *FeatureManager) GetFeatureFlags() (model.FeatureSet, error)
InitFeatures
- Purpose: Initializes features (Not implemented in OSS). Logs an error message.
- Parameters:
req
(model.FeatureSet): The feature set to initialize.
- Returns:
error
: Returnsnil
.
func (fm *FeatureManager) InitFeatures(req model.FeatureSet) error
UpdateFeatureFlag
- Purpose: Updates a feature flag (Not implemented in OSS). Logs an error message.
- Parameters:
req
(model.Feature): The feature to update.
- Returns:
error
: Returnsnil
.
func (fm *FeatureManager) UpdateFeatureFlag(req model.Feature) error
GetFeatureFlag
- Purpose: Retrieves a specific feature based on its key.
- Parameters:
key
(string): The key of the feature to retrieve.
- Returns:
model.Feature
: The feature associated with the given key.error
: Returnsnil
if successful. Returnsmodel.ErrFeatureUnavailable
if the feature is not found.
func (fm *FeatureManager) GetFeatureFlag(key string) (model.Feature, error)
Getting Started Relevance: NO