From 89092a1e697788428f76fead65371b7c904cd13f Mon Sep 17 00:00:00 2001 From: Andre Pereira Date: Wed, 26 Jul 2023 14:33:16 +0100 Subject: [PATCH] Tempo: Use feature toggle to control TraceQL streaming (#72288) Rename traceql streaming feature toggle. Remove the manual toggle from Options component and use the feature toggle --- .../feature-toggles/index.md | 2 +- .../src/types/featureToggles.gen.ts | 2 +- .../dataquery/x/TempoDataQuery_types.gen.ts | 4 ---- pkg/services/featuremgmt/registry.go | 4 ++-- pkg/services/featuremgmt/toggles_gen.csv | 2 +- pkg/services/featuremgmt/toggles_gen.go | 6 +++--- .../kinds/dataquery/types_dataquery_gen.go | 3 --- .../plugins/datasource/tempo/dataquery.cue | 2 -- .../plugins/datasource/tempo/dataquery.gen.ts | 4 ---- .../plugins/datasource/tempo/datasource.ts | 8 ++++---- .../traceql/TempoQueryBuilderOptions.tsx | 19 +------------------ 11 files changed, 13 insertions(+), 43 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 1ff5ea82745..e7bb180363e 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -124,7 +124,7 @@ Experimental features might be changed or removed without prior notice. | `awsDatasourcesTempCredentials` | Support temporary security credentials in AWS plugins for Grafana Cloud customers | | `toggleLabelsInLogsUI` | Enable toggleable filters in log details view | | `mlExpressions` | Enable support for Machine Learning in server-side expressions | -| `disableTraceQLStreaming` | Disables the option to stream the response of TraceQL queries of the Tempo data source | +| `traceQLStreaming` | Enables response streaming of TraceQL queries of the Tempo data source | | `grafanaAPIServer` | Enable Kubernetes API Server for Grafana resources | | `featureToggleAdminPage` | Enable admin page for managing feature toggles from the Grafana front-end | | `awsAsyncQueryCaching` | Enable caching for async queries for Redshift and Athena. Requires that the `useCachingService` feature toggle is enabled and the datasource has caching and async query support enabled | diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 570d7400ec5..449ebfd07b3 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -110,7 +110,7 @@ export interface FeatureToggles { transformationsRedesign?: boolean; toggleLabelsInLogsUI?: boolean; mlExpressions?: boolean; - disableTraceQLStreaming?: boolean; + traceQLStreaming?: boolean; grafanaAPIServer?: boolean; featureToggleAdminPage?: boolean; awsAsyncQueryCaching?: boolean; diff --git a/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts b/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts index e3099fc65cf..f148695125b 100644 --- a/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts +++ b/packages/grafana-schema/src/raw/composable/tempo/dataquery/x/TempoDataQuery_types.gen.ts @@ -51,10 +51,6 @@ export interface TempoQuery extends common.DataQuery { * @deprecated Query traces by span name */ spanName?: string; - /** - * Use the streaming API to get partial results as they are available - */ - streaming?: boolean; } export const defaultTempoQuery: Partial = { diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 48a1118c7a9..feca32609ff 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -633,8 +633,8 @@ var ( Owner: grafanaAlertingSquad, }, { - Name: "disableTraceQLStreaming", - Description: "Disables the option to stream the response of TraceQL queries of the Tempo data source", + Name: "traceQLStreaming", + Description: "Enables response streaming of TraceQL queries of the Tempo data source", Stage: FeatureStageExperimental, FrontendOnly: true, Owner: grafanaObservabilityTracesAndProfilingSquad, diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index 5bb00b56c20..7d16a0c55c6 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -91,7 +91,7 @@ awsDatasourcesTempCredentials,experimental,@grafana/aws-datasources,false,false, transformationsRedesign,GA,@grafana/observability-metrics,false,false,false,true toggleLabelsInLogsUI,experimental,@grafana/observability-logs,false,false,false,true mlExpressions,experimental,@grafana/alerting-squad,false,false,false,false -disableTraceQLStreaming,experimental,@grafana/observability-traces-and-profiling,false,false,false,true +traceQLStreaming,experimental,@grafana/observability-traces-and-profiling,false,false,false,true grafanaAPIServer,experimental,@grafana/grafana-app-platform-squad,false,false,false,false featureToggleAdminPage,experimental,@grafana/grafana-operator-experience-squad,false,false,true,false awsAsyncQueryCaching,experimental,@grafana/aws-datasources,false,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index ea7892e55b2..14adb86c21c 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -375,9 +375,9 @@ const ( // Enable support for Machine Learning in server-side expressions FlagMlExpressions = "mlExpressions" - // FlagDisableTraceQLStreaming - // Disables the option to stream the response of TraceQL queries of the Tempo data source - FlagDisableTraceQLStreaming = "disableTraceQLStreaming" + // FlagTraceQLStreaming + // Enables response streaming of TraceQL queries of the Tempo data source + FlagTraceQLStreaming = "traceQLStreaming" // FlagGrafanaAPIServer // Enable Kubernetes API Server for Grafana resources diff --git a/pkg/tsdb/tempo/kinds/dataquery/types_dataquery_gen.go b/pkg/tsdb/tempo/kinds/dataquery/types_dataquery_gen.go index 771f71d6e09..9a1e4d8c9cc 100644 --- a/pkg/tsdb/tempo/kinds/dataquery/types_dataquery_gen.go +++ b/pkg/tsdb/tempo/kinds/dataquery/types_dataquery_gen.go @@ -121,9 +121,6 @@ type TempoQuery struct { // @deprecated Query traces by span name SpanName *string `json:"spanName,omitempty"` - - // Use the streaming API to get partial results as they are available - Streaming *bool `json:"streaming,omitempty"` } // TempoQueryType search = Loki search, nativeSearch = Tempo search for backwards compatibility diff --git a/public/app/plugins/datasource/tempo/dataquery.cue b/public/app/plugins/datasource/tempo/dataquery.cue index 82016c131d3..a54bb10e116 100644 --- a/public/app/plugins/datasource/tempo/dataquery.cue +++ b/public/app/plugins/datasource/tempo/dataquery.cue @@ -44,8 +44,6 @@ composableKinds: DataQuery: { serviceMapIncludeNamespace?: bool // Defines the maximum number of traces that are returned from Tempo limit?: int64 - // Use the streaming API to get partial results as they are available - streaming?: bool filters: [...#TraceqlFilter] } @cuetsy(kind="interface") @grafana(TSVeneer="type") diff --git a/public/app/plugins/datasource/tempo/dataquery.gen.ts b/public/app/plugins/datasource/tempo/dataquery.gen.ts index 0ddba987cfd..7bfac5a1758 100644 --- a/public/app/plugins/datasource/tempo/dataquery.gen.ts +++ b/public/app/plugins/datasource/tempo/dataquery.gen.ts @@ -48,10 +48,6 @@ export interface TempoQuery extends common.DataQuery { * @deprecated Query traces by span name */ spanName?: string; - /** - * Use the streaming API to get partial results as they are available - */ - streaming?: boolean; } export const defaultTempoQuery: Partial = { diff --git a/public/app/plugins/datasource/tempo/datasource.ts b/public/app/plugins/datasource/tempo/datasource.ts index bc72734c7ea..bc58422a6fb 100644 --- a/public/app/plugins/datasource/tempo/datasource.ts +++ b/public/app/plugins/datasource/tempo/datasource.ts @@ -223,10 +223,10 @@ export class TempoDatasource extends DataSourceWithBackend(({ onChange, query }) query.limit = DEFAULT_LIMIT; } - if (!query.hasOwnProperty('streaming')) { - query.streaming = !config.featureToggles.disableTraceQLStreaming; - } - const onLimitChange = (e: React.FormEvent) => { onChange({ ...query, limit: parseInt(e.currentTarget.value, 10) }); }; - const onStreamingChange = (e: React.FormEvent) => { - onChange({ ...query, streaming: e.currentTarget.checked }); - }; - const collapsedInfoList = [`Limit: ${query.limit || DEFAULT_LIMIT}`]; - if (!config.featureToggles.disableTraceQLStreaming) { - collapsedInfoList.push(`Streaming: ${query.streaming ? 'Yes' : 'No'}`); - } return ( <> @@ -50,11 +38,6 @@ export const TempoQueryBuilderOptions = React.memo(({ onChange, query }) value={query.limit} /> - {!config.featureToggles.disableTraceQLStreaming && ( - - - - )}