diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index 6525635a5e9..c9ba8538b5c 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -29,24 +29,25 @@ Some stable features are enabled by default. You can disable a stable feature by | `internationalization` | Enables internationalization | Yes | | `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes | | `accessTokenExpirationCheck` | Enable OAuth access_token expiration check and token refresh using the refresh_token | | -| `disablePrometheusExemplarSampling` | Disable Prometheus examplar sampling | | +| `disablePrometheusExemplarSampling` | Disable Prometheus exemplar sampling | | | `logsSampleInExplore` | Enables access to the logs sample feature in Explore | Yes | ## Beta feature toggles -| Feature toggle name | Description | -| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `trimDefaults` | Use cue schema to remove values that will be applied automatically | -| `panelTitleSearch` | Search for dashboards using panel title | -| `prometheusAzureOverrideAudience` | Experimental. Allow override default AAD audience for Azure Prometheus endpoint | -| `migrationLocking` | Lock database during migrations | -| `newDBLibrary` | Use jmoiron/sqlx rather than xorm for a few backend services | -| `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db | -| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) | -| `disableAngular` | Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime. | -| `topnav` | Displays new top nav and page layouts | -| `accessControlOnCall` | Access control primitives for OnCall | -| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing | +| Feature toggle name | Description | +| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `trimDefaults` | Use cue schema to remove values that will be applied automatically | +| `panelTitleSearch` | Search for dashboards using panel title | +| `prometheusAzureOverrideAudience` | Experimental. Allow override default AAD audience for Azure Prometheus endpoint | +| `migrationLocking` | Lock database during migrations | +| `newDBLibrary` | Use jmoiron/sqlx rather than xorm for a few backend services | +| `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db | +| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) | +| `disableAngular` | Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime. | +| `topnav` | Displays new top nav and page layouts | +| `accessControlOnCall` | Access control primitives for OnCall | +| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing | +| `disableElasticsearchBackendExploreQuery` | Disable executing of Elasticsearch Explore queries trough backend | ## Alpha feature toggles diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 51e8a88c43d..dd8f8ac59ee 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -84,4 +84,5 @@ export interface FeatureToggles { timeSeriesTable?: boolean; influxdbBackendMigration?: boolean; clientTokenRotation?: boolean; + disableElasticsearchBackendExploreQuery?: boolean; } diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 34d4e9bbbd1..09a9e57d9c6 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -334,7 +334,7 @@ var ( }, { Name: "disablePrometheusExemplarSampling", - Description: "Disable Prometheus examplar sampling", + Description: "Disable Prometheus exemplar sampling", State: FeatureStateStable, Owner: grafanaObservabilityMetricsSquad, }, @@ -441,5 +441,11 @@ var ( State: FeatureStateAlpha, Owner: grafanaAuthnzSquad, }, + { + Name: "disableElasticsearchBackendExploreQuery", + Description: "Disable executing of Elasticsearch Explore queries trough backend", + State: FeatureStateBeta, + Owner: grafanaObservabilityLogsSquad, + }, } ) diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index d351153838d..66650de00ae 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -65,3 +65,4 @@ prometheusMetricEncyclopedia,alpha,@grafana/observability-metrics,false,false,fa timeSeriesTable,alpha,@grafana/app-o11y,false,false,false,true influxdbBackendMigration,alpha,@grafana/observability-metrics,false,false,false,true clientTokenRotation,alpha,@grafana/grafana-authnz-team,false,false,false,false +disableElasticsearchBackendExploreQuery,beta,@grafana/observability-logs,false,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index ba99424a28f..550069987d1 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -208,7 +208,7 @@ const ( FlagAuthnService = "authnService" // FlagDisablePrometheusExemplarSampling - // Disable Prometheus examplar sampling + // Disable Prometheus exemplar sampling FlagDisablePrometheusExemplarSampling = "disablePrometheusExemplarSampling" // FlagAlertingBacktesting @@ -270,4 +270,8 @@ const ( // FlagClientTokenRotation // Replaces the current in-request token rotation so that the client initiates the rotation FlagClientTokenRotation = "clientTokenRotation" + + // FlagDisableElasticsearchBackendExploreQuery + // Disable executing of Elasticsearch Explore queries trough backend + FlagDisableElasticsearchBackendExploreQuery = "disableElasticsearchBackendExploreQuery" ) diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index c30e87d0c07..762d6f047e2 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -641,8 +641,12 @@ export class ElasticDatasource } query(request: DataQueryRequest): Observable { + // Run request through backend if it is coming from Explore and disableElasticsearchBackendExploreQuery is not set + // or if elasticsearchBackendMigration feature toggle is enabled + const { elasticsearchBackendMigration, disableElasticsearchBackendExploreQuery } = config.featureToggles; const shouldRunTroughBackend = - request.app === CoreApp.Explore && config.featureToggles.elasticsearchBackendMigration; + (request.app === CoreApp.Explore && !disableElasticsearchBackendExploreQuery) || elasticsearchBackendMigration; + if (shouldRunTroughBackend) { const start = new Date(); return super.query(request).pipe(tap((response) => trackQuery(response, request, start)));