mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-29 04:22:01 +08:00

### Summary remove unused feature flags - ENTERPRISE_PLAN = 'ENTERPRISE_PLAN', - BASIC_PLAN = 'BASIC_PLAN', - ALERT_CHANNEL_SLACK = 'ALERT_CHANNEL_SLACK', - ALERT_CHANNEL_WEBHOOK = 'ALERT_CHANNEL_WEBHOOK', - ALERT_CHANNEL_PAGERDUTY = 'ALERT_CHANNEL_PAGERDUTY', - ALERT_CHANNEL_OPSGENIE = 'ALERT_CHANNEL_OPSGENIE', - ALERT_CHANNEL_MSTEAMS = 'ALERT_CHANNEL_MSTEAMS', - CUSTOM_METRICS_FUNCTION = 'CUSTOM_METRICS_FUNCTION', - QUERY_BUILDER_PANELS = 'QUERY_BUILDER_PANELS', - QUERY_BUILDER_ALERTS = 'QUERY_BUILDER_ALERTS', - DISABLE_UPSELL = 'DISABLE_UPSELL', - OSS = 'OSS', - QUERY_BUILDER_SEARCH_V2 = 'QUERY_BUILDER_SEARCH_V2', - AWS_INTEGRATION = 'AWS_INTEGRATION', remove ProPlan concept
61 lines
1.4 KiB
Go
61 lines
1.4 KiB
Go
package featureManager
|
|
|
|
import (
|
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
|
"github.com/SigNoz/signoz/pkg/query-service/model"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type FeatureManager struct {
|
|
}
|
|
|
|
func StartManager() *FeatureManager {
|
|
fM := &FeatureManager{}
|
|
return fM
|
|
}
|
|
|
|
// CheckFeature will be internally used by backend routines
|
|
// for feature gating
|
|
func (fm *FeatureManager) CheckFeature(featureKey string) error {
|
|
|
|
feature, err := fm.GetFeatureFlag(featureKey)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if feature.Active {
|
|
return nil
|
|
}
|
|
|
|
return model.ErrFeatureUnavailable{Key: featureKey}
|
|
}
|
|
|
|
// GetFeatureFlags returns current features
|
|
func (fm *FeatureManager) GetFeatureFlags() (model.FeatureSet, error) {
|
|
features := constants.DEFAULT_FEATURE_SET
|
|
return features, nil
|
|
}
|
|
|
|
func (fm *FeatureManager) InitFeatures(req model.FeatureSet) error {
|
|
zap.L().Error("InitFeatures not implemented in OSS")
|
|
return nil
|
|
}
|
|
|
|
func (fm *FeatureManager) UpdateFeatureFlag(req model.Feature) error {
|
|
zap.L().Error("UpdateFeatureFlag not implemented in OSS")
|
|
return nil
|
|
}
|
|
|
|
func (fm *FeatureManager) GetFeatureFlag(key string) (model.Feature, error) {
|
|
features, err := fm.GetFeatureFlags()
|
|
if err != nil {
|
|
return model.Feature{}, err
|
|
}
|
|
for _, feature := range features {
|
|
if feature.Name == key {
|
|
return feature, nil
|
|
}
|
|
}
|
|
return model.Feature{}, model.ErrFeatureUnavailable{Key: key}
|
|
}
|