Elasticsearch: Change feature toggle for backend migration to enableElasticsearchBackendQuerying (#66500)

* Elasticsearch: Change feature toggle for backend migration to enableElasticsearchBackendQuerying

* Update logic in data source

* Run test to re-genartate toggle
This commit is contained in:
Ivana Huckova 2023-04-14 11:24:35 +02:00 committed by GitHub
parent cab3ba519a
commit f48c858ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 50 deletions

View File

@ -19,41 +19,41 @@ This page contains a list of available feature toggles. To learn how to turn on
Some stable features are enabled by default. You can disable a stable feature by setting the feature flag to "false" in the configuration.
| Feature toggle name | Description | Enabled by default |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | |
| `database_metrics` | Add Prometheus metrics for database tables | |
| `featureHighlights` | Highlight Grafana Enterprise features | |
| `cloudWatchDynamicLabels` | Use dynamic labels instead of alias patterns in CloudWatch datasource | Yes |
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
| `internationalization` | Enables internationalization | Yes |
| `topnav` | Enables new top navigation and page layouts | Yes |
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
| `newPanelChromeUI` | Show updated look and feel of grafana-ui PanelChrome: panel header, icons, and menu | Yes |
| `accessTokenExpirationCheck` | Enable OAuth access_token expiration check and token refresh using the refresh_token | |
| `emptyDashboardPage` | Enable the redesigned user interface of a dashboard page that includes no panels | Yes |
| `disablePrometheusExemplarSampling` | Disable Prometheus exemplar sampling | |
| `logsSampleInExplore` | Enables access to the logs sample feature in Explore | Yes |
| `useCachingService` | When turned on, the new query and resource caching implementation using a wire service inject will be used in place of the previous middleware implementation | |
| `disableElasticsearchBackendQuerying` | Disable the processing of queries and responses in the Elasticsearch data source through backend | |
| Feature toggle name | Description | Enabled by default |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | |
| `database_metrics` | Add Prometheus metrics for database tables | |
| `featureHighlights` | Highlight Grafana Enterprise features | |
| `cloudWatchDynamicLabels` | Use dynamic labels instead of alias patterns in CloudWatch datasource | Yes |
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
| `internationalization` | Enables internationalization | Yes |
| `topnav` | Enables new top navigation and page layouts | Yes |
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
| `newPanelChromeUI` | Show updated look and feel of grafana-ui PanelChrome: panel header, icons, and menu | Yes |
| `accessTokenExpirationCheck` | Enable OAuth access_token expiration check and token refresh using the refresh_token | |
| `emptyDashboardPage` | Enable the redesigned user interface of a dashboard page that includes no panels | Yes |
| `disablePrometheusExemplarSampling` | Disable Prometheus exemplar sampling | |
| `logsSampleInExplore` | Enables access to the logs sample feature in Explore | Yes |
| `useCachingService` | When turned on, the new query and resource caching implementation using a wire service inject will be used in place of the previous middleware implementation | |
## 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 |
| `correlations` | Correlations page |
| `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. |
| `grpcServer` | Run the GRPC server |
| `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
| `renderAuthJWT` | Uses JWT-based auth for rendering instead of relying on remote cache |
| 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 |
| `correlations` | Correlations page |
| `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. |
| `grpcServer` | Run the GRPC server |
| `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
| `renderAuthJWT` | Uses JWT-based auth for rendering instead of relying on remote cache |
| `enableElasticsearchBackendQuerying` | Enable the processing of queries and responses in the Elasticsearch data source through backend |
## Alpha feature toggles

View File

@ -95,6 +95,6 @@ export interface FeatureToggles {
externalServiceAuth?: boolean;
dataplaneFrontendFallback?: boolean;
useCachingService?: boolean;
disableElasticsearchBackendQuerying?: boolean;
enableElasticsearchBackendQuerying?: boolean;
authenticationConfigUI?: boolean;
}

View File

@ -515,9 +515,9 @@ var (
RequiresRestart: true,
},
{
Name: "disableElasticsearchBackendQuerying",
Description: "Disable the processing of queries and responses in the Elasticsearch data source through backend",
State: FeatureStateStable,
Name: "enableElasticsearchBackendQuerying",
Description: "Enable the processing of queries and responses in the Elasticsearch data source through backend",
State: FeatureStateBeta,
Owner: grafanaObservabilityLogsSquad,
},
{

View File

@ -76,5 +76,5 @@ pyroscopeFlameGraph,alpha,@grafana/observability-traces-and-profiling,false,fals
externalServiceAuth,alpha,@grafana/grafana-authnz-team,true,false,false,false
dataplaneFrontendFallback,alpha,@grafana/observability-metrics,false,false,false,true
useCachingService,stable,@grafana/grafana-operator-experience-squad,false,false,true,false
disableElasticsearchBackendQuerying,stable,@grafana/observability-logs,false,false,false,false
enableElasticsearchBackendQuerying,beta,@grafana/observability-logs,false,false,false,false
authenticationConfigUI,alpha,@grafana/grafana-authnz-team,false,false,false,false

1 Name State Owner requiresDevMode RequiresLicense RequiresRestart FrontendOnly
76 externalServiceAuth alpha @grafana/grafana-authnz-team true false false false
77 dataplaneFrontendFallback alpha @grafana/observability-metrics false false false true
78 useCachingService stable @grafana/grafana-operator-experience-squad false false true false
79 disableElasticsearchBackendQuerying enableElasticsearchBackendQuerying stable beta @grafana/observability-logs false false false false
80 authenticationConfigUI alpha @grafana/grafana-authnz-team false false false false

View File

@ -315,9 +315,9 @@ const (
// When turned on, the new query and resource caching implementation using a wire service inject will be used in place of the previous middleware implementation
FlagUseCachingService = "useCachingService"
// FlagDisableElasticsearchBackendQuerying
// Disable the processing of queries and responses in the Elasticsearch data source through backend
FlagDisableElasticsearchBackendQuerying = "disableElasticsearchBackendQuerying"
// FlagEnableElasticsearchBackendQuerying
// Enable the processing of queries and responses in the Elasticsearch data source through backend
FlagEnableElasticsearchBackendQuerying = "enableElasticsearchBackendQuerying"
// FlagAuthenticationConfigUI
// Enables authentication configuration UI

View File

@ -43,12 +43,6 @@ jest.mock('@grafana/runtime', () => ({
},
};
},
config: {
buildInfo: {},
featureToggles: {
disableElasticsearchBackendQuerying: true,
},
},
}));
const TIMESRV_START = [2022, 8, 21, 6, 10, 10];

View File

@ -502,8 +502,8 @@ export class ElasticDatasource
}
getLogRowContext = async (row: LogRowModel, options?: LogRowContextOptions): Promise<{ data: DataFrame[] }> => {
const { disableElasticsearchBackendQuerying } = config.featureToggles;
if (!disableElasticsearchBackendQuerying) {
const { enableElasticsearchBackendQuerying } = config.featureToggles;
if (enableElasticsearchBackendQuerying) {
const contextRequest = this.makeLogContextDataRequest(row, options);
return lastValueFrom(
@ -680,8 +680,8 @@ export class ElasticDatasource
}
query(request: DataQueryRequest<ElasticsearchQuery>): Observable<DataQueryResponse> {
const { disableElasticsearchBackendQuerying } = config.featureToggles;
if (!disableElasticsearchBackendQuerying) {
const { enableElasticsearchBackendQuerying } = config.featureToggles;
if (enableElasticsearchBackendQuerying) {
const start = new Date();
return super.query(request).pipe(tap((response) => trackQuery(response, request, start)));
}