data sources: feature toggle: route explore queries to the new query service (#103192)
* data sources: route explore queries to the new query service * prettier fix * easier to read logical statement
This commit is contained in:
@@ -170,6 +170,7 @@ Experimental features might be changed or removed without prior notice.
|
||||
| `queryService` | Register /apis/query.grafana.app/ -- will eventually replace /api/ds/query |
|
||||
| `queryServiceRewrite` | Rewrite requests targeting /ds/query to the query service |
|
||||
| `queryServiceFromUI` | Routes requests to the new query service |
|
||||
| `queryServiceFromExplore` | Routes explore requests to the new query service |
|
||||
| `cachingOptimizeSerializationMemoryUsage` | If enabled, the caching backend gradually serializes query responses for the cache, comparing against the configured `[caching]max_value_mb` value as it goes. This can can help prevent Grafana from running out of memory while attempting to cache very large query responses. |
|
||||
| `prometheusCodeModeMetricNamesSearch` | Enables search for metric names in Code Mode, to improve performance when working with an enormous number of metric names |
|
||||
| `alertmanagerRemoteSecondary` | Enable Grafana to sync configuration and state with a remote Alertmanager. |
|
||||
|
||||
@@ -407,6 +407,10 @@ export interface FeatureToggles {
|
||||
*/
|
||||
queryServiceFromUI?: boolean;
|
||||
/**
|
||||
* Routes explore requests to the new query service
|
||||
*/
|
||||
queryServiceFromExplore?: boolean;
|
||||
/**
|
||||
* Runs CloudWatch metrics queries as separate batches
|
||||
*/
|
||||
cloudWatchBatchQueries?: boolean;
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
parseLiveChannelAddress,
|
||||
ScopedVars,
|
||||
AdHocVariableFilter,
|
||||
CoreApp,
|
||||
} from '@grafana/data';
|
||||
|
||||
import { reportInteraction } from '../analytics/utils';
|
||||
@@ -208,6 +209,18 @@ class DataSourceWithBackend<
|
||||
|
||||
let url = '/api/ds/query?ds_type=' + this.type;
|
||||
|
||||
// Use the new query service for explore
|
||||
if (config.featureToggles.queryServiceFromExplore && request.app === CoreApp.Explore) {
|
||||
// make sure query-service is enabled on the backend
|
||||
const isQueryServiceEnabled = config.featureToggles.queryService;
|
||||
const isExperimentalAPIsEnabled = config.featureToggles.grafanaAPIServerWithExperimentalAPIs;
|
||||
if (!isQueryServiceEnabled && !isExperimentalAPIsEnabled) {
|
||||
console.warn('feature toggle queryServiceFromExplore also requires the queryService to be running');
|
||||
} else {
|
||||
url = `/apis/query.grafana.app/v0alpha1/namespaces/${config.namespace}/query?ds_type=${this.type}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Use the new query service
|
||||
if (config.featureToggles.queryServiceFromUI) {
|
||||
if (!(config.featureToggles.queryService || config.featureToggles.grafanaAPIServerWithExperimentalAPIs)) {
|
||||
|
||||
@@ -684,6 +684,13 @@ var (
|
||||
Owner: grafanaAppPlatformSquad,
|
||||
FrontendOnly: true, // and can change at startup
|
||||
},
|
||||
{
|
||||
Name: "queryServiceFromExplore",
|
||||
Description: "Routes explore requests to the new query service",
|
||||
Stage: FeatureStageExperimental,
|
||||
Owner: grafanaDatasourcesCoreServicesSquad,
|
||||
FrontendOnly: true,
|
||||
},
|
||||
{
|
||||
Name: "cloudWatchBatchQueries",
|
||||
Description: "Runs CloudWatch metrics queries as separate batches",
|
||||
|
||||
@@ -90,6 +90,7 @@ datasourceQueryTypes,experimental,@grafana/grafana-app-platform-squad,false,true
|
||||
queryService,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||
queryServiceRewrite,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||
queryServiceFromUI,experimental,@grafana/grafana-app-platform-squad,false,false,true
|
||||
queryServiceFromExplore,experimental,@grafana/grafana-datasources-core-services,false,false,true
|
||||
cloudWatchBatchQueries,preview,@grafana/aws-datasources,false,false,false
|
||||
recoveryThreshold,GA,@grafana/alerting-squad,false,true,false
|
||||
lokiStructuredMetadata,GA,@grafana/observability-logs,false,false,false
|
||||
|
||||
|
@@ -371,6 +371,10 @@ const (
|
||||
// Routes requests to the new query service
|
||||
FlagQueryServiceFromUI = "queryServiceFromUI"
|
||||
|
||||
// FlagQueryServiceFromExplore
|
||||
// Routes explore requests to the new query service
|
||||
FlagQueryServiceFromExplore = "queryServiceFromExplore"
|
||||
|
||||
// FlagCloudWatchBatchQueries
|
||||
// Runs CloudWatch metrics queries as separate batches
|
||||
FlagCloudWatchBatchQueries = "cloudWatchBatchQueries"
|
||||
|
||||
@@ -3660,6 +3660,19 @@
|
||||
"requiresRestart": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "queryServiceFromExplore",
|
||||
"resourceVersion": "1743513714582",
|
||||
"creationTimestamp": "2025-04-01T13:21:54Z"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Routes explore requests to the new query service",
|
||||
"stage": "experimental",
|
||||
"codeowner": "@grafana/grafana-datasources-core-services",
|
||||
"frontend": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "queryServiceFromUI",
|
||||
|
||||
Reference in New Issue
Block a user