Skip to main content

manager.go - Overview

  1. 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.

  2. 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: Returns nil if the feature is active. Returns model.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 of model.Feature representing the available features. Includes default features and the OSS feature.
    • error: Returns nil 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: Returns nil.
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: Returns nil.
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: Returns nil if successful. Returns model.ErrFeatureUnavailable if the feature is not found.
func (fm *FeatureManager) GetFeatureFlag(key string) (model.Feature, error)

Getting Started Relevance: NO