mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Removed feature toggle pluginsDynamicAngularDetectionPatterns (#85956)
* Plugins: Removed feature toggle pluginsDynamicAngularDetectionPatterns * re-generate feature toggles
This commit is contained in:
@@ -20,7 +20,7 @@ This page contains a list of available feature toggles. To learn how to turn on
|
||||
Some features are enabled by default. You can disable these feature by setting the feature flag to "false" in the configuration.
|
||||
|
||||
| Feature toggle name | Description | Enabled by default |
|
||||
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | |
|
||||
| `publicDashboards` | [Deprecated] Public dashboards are now enabled by default; to disable them, use the configuration setting. This feature toggle will be removed in the next major version. | Yes |
|
||||
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
||||
@@ -38,7 +38,6 @@ Some features are enabled by default. You can disable these feature by setting t
|
||||
| `dataplaneFrontendFallback` | Support dataplane contract field name change for transformations and field name matchers where the name is different | Yes |
|
||||
| `enableElasticsearchBackendQuerying` | Enable the processing of queries and responses in the Elasticsearch data source through backend | Yes |
|
||||
| `recordedQueriesMulti` | Enables writing multiple items from a single query within Recorded Queries | Yes |
|
||||
| `pluginsDynamicAngularDetectionPatterns` | Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones | Yes |
|
||||
| `logsExploreTableVisualisation` | A table visualisation for logs in Explore | Yes |
|
||||
| `transformationsRedesign` | Enables the transformations redesign | Yes |
|
||||
| `traceQLStreaming` | Enables response streaming of TraceQL queries of the Tempo data source | |
|
||||
|
||||
@@ -86,7 +86,6 @@ export interface FeatureToggles {
|
||||
sqlDatasourceDatabaseSelection?: boolean;
|
||||
lokiFormatQuery?: boolean;
|
||||
recordedQueriesMulti?: boolean;
|
||||
pluginsDynamicAngularDetectionPatterns?: boolean;
|
||||
vizAndWidgetSplit?: boolean;
|
||||
prometheusIncrementalQueryInstrumentation?: boolean;
|
||||
logsExploreTableVisualisation?: boolean;
|
||||
|
||||
@@ -508,14 +508,6 @@ var (
|
||||
Owner: grafanaObservabilityMetricsSquad,
|
||||
AllowSelfServe: false,
|
||||
},
|
||||
{
|
||||
Name: "pluginsDynamicAngularDetectionPatterns",
|
||||
Description: "Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones",
|
||||
Stage: FeatureStageGeneralAvailability,
|
||||
FrontendOnly: false,
|
||||
Owner: grafanaPluginsPlatformSquad,
|
||||
Expression: "true", // enabled by default
|
||||
},
|
||||
{
|
||||
Name: "vizAndWidgetSplit",
|
||||
Description: "Split panels between visualizations and widgets",
|
||||
|
||||
@@ -67,7 +67,6 @@ frontendSandboxMonitorOnly,experimental,@grafana/plugins-platform-backend,false,
|
||||
sqlDatasourceDatabaseSelection,preview,@grafana/dataviz-squad,false,false,true
|
||||
lokiFormatQuery,experimental,@grafana/observability-logs,false,false,true
|
||||
recordedQueriesMulti,GA,@grafana/observability-metrics,false,false,false
|
||||
pluginsDynamicAngularDetectionPatterns,GA,@grafana/plugins-platform-backend,false,false,false
|
||||
vizAndWidgetSplit,experimental,@grafana/dashboards-squad,false,false,true
|
||||
prometheusIncrementalQueryInstrumentation,experimental,@grafana/observability-metrics,false,false,true
|
||||
logsExploreTableVisualisation,GA,@grafana/observability-logs,false,false,true
|
||||
|
||||
|
@@ -279,10 +279,6 @@ const (
|
||||
// Enables writing multiple items from a single query within Recorded Queries
|
||||
FlagRecordedQueriesMulti = "recordedQueriesMulti"
|
||||
|
||||
// FlagPluginsDynamicAngularDetectionPatterns
|
||||
// Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones
|
||||
FlagPluginsDynamicAngularDetectionPatterns = "pluginsDynamicAngularDetectionPatterns"
|
||||
|
||||
// FlagVizAndWidgetSplit
|
||||
// Split panels between visualizations and widgets
|
||||
FlagVizAndWidgetSplit = "vizAndWidgetSplit"
|
||||
|
||||
@@ -1120,7 +1120,8 @@
|
||||
"metadata": {
|
||||
"name": "pluginsDynamicAngularDetectionPatterns",
|
||||
"resourceVersion": "1712639261786",
|
||||
"creationTimestamp": "2024-04-09T05:07:41Z"
|
||||
"creationTimestamp": "2024-04-09T05:07:41Z",
|
||||
"deletionTimestamp": "2024-04-11T13:53:48Z"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones",
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins/log"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angulardetector"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angularpatternsstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
@@ -31,10 +30,8 @@ var (
|
||||
// Dynamic is an angulardetector.DetectorsProvider that calls GCOM to get Angular detection patterns,
|
||||
// converts them to detectors and caches them for all future calls.
|
||||
// It also provides a background service that will periodically refresh the patterns from GCOM.
|
||||
// If the feature flag FlagPluginsDynamicAngularDetectionPatterns is disabled, the background service is disabled.
|
||||
type Dynamic struct {
|
||||
log log.Logger
|
||||
features featuremgmt.FeatureToggles
|
||||
|
||||
httpClient http.Client
|
||||
baseURL string
|
||||
@@ -53,7 +50,7 @@ type Dynamic struct {
|
||||
backgroundJobInterval time.Duration
|
||||
}
|
||||
|
||||
func ProvideDynamic(cfg *setting.Cfg, store angularpatternsstore.Service, features featuremgmt.FeatureToggles) (*Dynamic, error) {
|
||||
func ProvideDynamic(cfg *setting.Cfg, store angularpatternsstore.Service) (*Dynamic, error) {
|
||||
backgroundJobInterval := backgroundJobIntervalOnPrem
|
||||
if cfg.StackID != "" {
|
||||
// Use a shorter interval for cloud.
|
||||
@@ -63,16 +60,11 @@ func ProvideDynamic(cfg *setting.Cfg, store angularpatternsstore.Service, featur
|
||||
|
||||
d := &Dynamic{
|
||||
log: log.New("plugin.angulardetectorsprovider.dynamic"),
|
||||
features: features,
|
||||
store: store,
|
||||
httpClient: makeHttpClient(),
|
||||
baseURL: cfg.GrafanaComURL,
|
||||
backgroundJobInterval: backgroundJobInterval,
|
||||
}
|
||||
if d.IsDisabled() {
|
||||
// Do not attempt to restore if the background service is disabled (no feature flag)
|
||||
return d, nil
|
||||
}
|
||||
d.log.Debug("Providing dynamic angular detection patterns", "baseURL", d.baseURL, "interval", d.backgroundJobInterval)
|
||||
|
||||
// Perform the initial restore from db
|
||||
@@ -233,11 +225,6 @@ func (d *Dynamic) setDetectorsFromCache(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsDisabled returns true if FlagPluginsDynamicAngularDetectionPatterns is not enabled.
|
||||
func (d *Dynamic) IsDisabled() bool {
|
||||
return !d.features.IsEnabledGlobally(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns)
|
||||
}
|
||||
|
||||
// randomSkew returns a random time.Duration between 0 and maxSkew.
|
||||
// This can be added to d.backgroundJobInterval to skew it by a random amount.
|
||||
func (d *Dynamic) randomSkew(maxSkew time.Duration) time.Duration {
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/kvstore"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angulardetector"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angularpatternsstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
@@ -343,18 +342,6 @@ func TestDynamicAngularDetectorsProviderBackgroundService(t *testing.T) {
|
||||
backgroundJobIntervalOnPrem = oldBackgroundJobInterval
|
||||
})
|
||||
|
||||
t.Run("is disabled if feature flag is not present", func(t *testing.T) {
|
||||
svc := provideDynamic(t, srv.URL)
|
||||
svc.features = featuremgmt.WithFeatures()
|
||||
require.True(t, svc.IsDisabled(), "background service should be disabled")
|
||||
})
|
||||
|
||||
t.Run("is enabled if feature flag is present", func(t *testing.T) {
|
||||
svc := provideDynamic(t, srv.URL)
|
||||
svc.features = featuremgmt.WithFeatures(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns)
|
||||
require.False(t, svc.IsDisabled(), "background service should be enabled")
|
||||
})
|
||||
|
||||
t.Run("fetches value from gcom on start if too much time has passed", func(t *testing.T) {
|
||||
gcomCallback := make(chan struct{})
|
||||
gcom := newDefaultGCOMScenario(func(_ http.ResponseWriter, _ *http.Request) {
|
||||
@@ -594,11 +581,7 @@ func provideDynamic(t *testing.T, gcomURL string, opts ...provideDynamicOpts) *D
|
||||
opt.cfg = setting.NewCfg()
|
||||
}
|
||||
opt.cfg.GrafanaComURL = gcomURL
|
||||
d, err := ProvideDynamic(
|
||||
opt.cfg,
|
||||
opt.store,
|
||||
featuremgmt.WithFeatures(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns),
|
||||
)
|
||||
d, err := ProvideDynamic(opt.cfg, opt.store)
|
||||
require.NoError(t, err)
|
||||
return d
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package angularinspector
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angulardetector"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angularinspector"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||
)
|
||||
|
||||
@@ -11,17 +10,13 @@ type Service struct {
|
||||
angularinspector.Inspector
|
||||
}
|
||||
|
||||
func ProvideService(features featuremgmt.FeatureToggles, dynamic *angulardetectorsprovider.Dynamic) (*Service, error) {
|
||||
var detectorsProvider angulardetector.DetectorsProvider
|
||||
var err error
|
||||
static := angularinspector.NewDefaultStaticDetectorsProvider()
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagPluginsDynamicAngularDetectionPatterns) {
|
||||
detectorsProvider = angulardetector.SequenceDetectorsProvider{dynamic, static}
|
||||
} else {
|
||||
detectorsProvider = static
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Service{Inspector: angularinspector.NewPatternListInspector(detectorsProvider)}, nil
|
||||
func ProvideService(dynamic *angulardetectorsprovider.Dynamic) (*Service, error) {
|
||||
return &Service{
|
||||
Inspector: angularinspector.NewPatternListInspector(
|
||||
angulardetector.SequenceDetectorsProvider{
|
||||
dynamic,
|
||||
angularinspector.NewDefaultStaticDetectorsProvider(),
|
||||
},
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -9,40 +9,19 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/kvstore"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angulardetector"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/angular/angularinspector"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angularpatternsstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
func TestProvideService(t *testing.T) {
|
||||
t.Run("uses hardcoded inspector if feature flag is not present", func(t *testing.T) {
|
||||
features := featuremgmt.WithFeatures()
|
||||
t.Run("uses dynamic inspector with hardcoded fallback", func(t *testing.T) {
|
||||
dynamic, err := angulardetectorsprovider.ProvideDynamic(
|
||||
setting.NewCfg(),
|
||||
angularpatternsstore.ProvideService(kvstore.NewFakeKVStore()),
|
||||
features,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
inspector, err := ProvideService(features, dynamic)
|
||||
require.NoError(t, err)
|
||||
require.IsType(t, inspector.Inspector, &angularinspector.PatternsListInspector{})
|
||||
patternsListInspector := inspector.Inspector.(*angularinspector.PatternsListInspector)
|
||||
detectors := patternsListInspector.DetectorsProvider.ProvideDetectors(context.Background())
|
||||
require.NotEmpty(t, detectors, "provided detectors should not be empty")
|
||||
})
|
||||
|
||||
t.Run("uses dynamic inspector with hardcoded fallback if feature flag is present", func(t *testing.T) {
|
||||
features := featuremgmt.WithFeatures(
|
||||
featuremgmt.FlagPluginsDynamicAngularDetectionPatterns,
|
||||
)
|
||||
dynamic, err := angulardetectorsprovider.ProvideDynamic(
|
||||
setting.NewCfg(),
|
||||
angularpatternsstore.ProvideService(kvstore.NewFakeKVStore()),
|
||||
features,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
inspector, err := ProvideService(features, dynamic)
|
||||
inspector, err := ProvideService(dynamic)
|
||||
require.NoError(t, err)
|
||||
require.IsType(t, inspector.Inspector, &angularinspector.PatternsListInspector{})
|
||||
require.IsType(t, inspector.Inspector.(*angularinspector.PatternsListInspector).DetectorsProvider, angulardetector.SequenceDetectorsProvider{})
|
||||
|
||||
Reference in New Issue
Block a user