Elasticsearch: Run Explore queries trough data source backend (#65339)

Elasticsearch: Execute Explore queries trough backend
This commit is contained in:
Ivana Huckova 2023-03-27 15:52:27 +02:00 committed by GitHub
parent cb68b1e0d1
commit f3da91f53f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 17 deletions

View File

@ -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

View File

@ -84,4 +84,5 @@ export interface FeatureToggles {
timeSeriesTable?: boolean;
influxdbBackendMigration?: boolean;
clientTokenRotation?: boolean;
disableElasticsearchBackendExploreQuery?: boolean;
}

View File

@ -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,
},
}
)

View File

@ -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

1 Name State Owner requiresDevMode RequiresLicense RequiresRestart FrontendOnly
65 timeSeriesTable alpha @grafana/app-o11y false false false true
66 influxdbBackendMigration alpha @grafana/observability-metrics false false false true
67 clientTokenRotation alpha @grafana/grafana-authnz-team false false false false
68 disableElasticsearchBackendExploreQuery beta @grafana/observability-logs false false false false

View File

@ -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"
)

View File

@ -641,8 +641,12 @@ export class ElasticDatasource
}
query(request: DataQueryRequest<ElasticsearchQuery>): Observable<DataQueryResponse> {
// 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)));