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

@ -20,7 +20,7 @@ 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 | |
@ -35,12 +35,11 @@ Some stable features are enabled by default. You can disable a stable feature by
| `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 | |
## 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 |
@ -54,6 +53,7 @@ Some stable features are enabled by default. You can disable a stable feature by
| `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)));
}