From c84d689ce0b6fc9a318e0879c1a135ea615e532a Mon Sep 17 00:00:00 2001 From: Matias Chomicki Date: Fri, 21 Jul 2023 13:53:10 +0200 Subject: [PATCH] Loki: Enable Query Splitting by default (#72094) * lokiQuerySplitting: enable feature flag by default * Query stats: add special note for stats + splitting --- .../configure-grafana/feature-toggles/index.md | 2 +- pkg/services/featuremgmt/registry.go | 3 ++- pkg/services/featuremgmt/toggles_gen.csv | 2 +- .../querybuilder/shared/QueryOptionGroup.tsx | 11 ++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) 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 2357921caee..d9e9fcd11dc 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -34,6 +34,7 @@ Some features are enabled by default. You can disable these feature by setting t | `disablePrometheusExemplarSampling` | Disable Prometheus exemplar sampling | | | `logsSampleInExplore` | Enables access to the logs sample feature in Explore | Yes | | `logsContextDatasourceUi` | Allow datasource to provide custom UI for context view | Yes | +| `lokiQuerySplitting` | Split large interval queries into subqueries with smaller time intervals | Yes | | `prometheusMetricEncyclopedia` | Adds the metrics explorer component to the Prometheus query builder as an option in metric select | Yes | | `prometheusDataplane` | Changes responses to from Prometheus to be compliant with the dataplane specification. In particular it sets the numeric Field.Name from 'Value' to the value of the `__name__` label when present. | Yes | | `lokiMetricDataplane` | Changes metric responses from Loki to be compliant with the dataplane specification. | Yes | @@ -90,7 +91,6 @@ Experimental features might be changed or removed without prior notice. | `nestedFolderPicker` | Enables the still in-development new folder picker to support nested folders | | `alertingBacktesting` | Rule backtesting API for alerting | | `editPanelCSVDragAndDrop` | Enables drag and drop for CSV and Excel files | -| `lokiQuerySplitting` | Split large interval queries into subqueries with smaller time intervals | | `lokiQuerySplittingConfig` | Give users the option to configure split durations for Loki queries | | `individualCookiePreferences` | Support overriding cookie preferences per user | | `onlyExternalOrgRoleSync` | Prohibits a user from changing organization roles synced with external auth providers | diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index fbc62f6fa21..2a8e800dc54 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -305,9 +305,10 @@ var ( { Name: "lokiQuerySplitting", Description: "Split large interval queries into subqueries with smaller time intervals", - Stage: FeatureStageExperimental, + Stage: FeatureStageGeneralAvailability, FrontendOnly: true, Owner: grafanaObservabilityLogsSquad, + Expression: "true", // turned on by default }, { Name: "lokiQuerySplittingConfig", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index a4acd694438..dad0520442a 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -43,7 +43,7 @@ editPanelCSVDragAndDrop,experimental,@grafana/grafana-bi-squad,false,false,false alertingNoNormalState,preview,@grafana/alerting-squad,false,false,false,false logsSampleInExplore,GA,@grafana/observability-logs,false,false,false,true logsContextDatasourceUi,GA,@grafana/observability-logs,false,false,false,true -lokiQuerySplitting,experimental,@grafana/observability-logs,false,false,false,true +lokiQuerySplitting,GA,@grafana/observability-logs,false,false,false,true lokiQuerySplittingConfig,experimental,@grafana/observability-logs,false,false,false,true individualCookiePreferences,experimental,@grafana/backend-platform,false,false,false,false onlyExternalOrgRoleSync,experimental,@grafana/grafana-authnz-team,false,false,false,false diff --git a/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup.tsx b/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup.tsx index d88ff69ff39..fad59f18c34 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/shared/QueryOptionGroup.tsx @@ -4,7 +4,8 @@ import { useToggle } from 'react-use'; import { getValueFormat, GrafanaTheme2 } from '@grafana/data'; import { Stack } from '@grafana/experimental'; -import { Collapse, useStyles2 } from '@grafana/ui'; +import { config } from '@grafana/runtime'; +import { Collapse, Icon, Tooltip, useStyles2 } from '@grafana/ui'; import { QueryStats } from 'app/plugins/datasource/loki/types'; export interface Props { @@ -45,6 +46,11 @@ export function QueryOptionGroup({ title, children, collapsedInfo, queryStats }: >
{children}
+ {queryStats && config.featureToggles.lokiQuerySplitting && ( + + + + )} {queryStats &&

This query will process approximately {convertUnits()}.

} ); @@ -92,5 +98,8 @@ const getStyles = (theme: GrafanaTheme2) => { color: theme.colors.text.secondary, fontSize: theme.typography.bodySmall.fontSize, }), + tooltip: css({ + marginRight: theme.spacing(0.25), + }), }; };