From d5294eb8fa71ba62546d00ebce7b9376ab6f2b1a Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Fri, 27 Jan 2023 17:30:25 +0100 Subject: [PATCH] Explore: Implement feature toggle for logs sample (#62291) * Explore: Implement feature toggle for logs sample * Run pkg/services/featuremgmt/toggles_gen_test.go * Remove boolean * Update copy --- .../configure-grafana/feature-toggles/index.md | 1 + packages/grafana-data/src/types/featureToggles.gen.ts | 1 + pkg/services/featuremgmt/registry.go | 8 ++++++++ pkg/services/featuremgmt/toggles_gen.go | 4 ++++ public/app/features/explore/Explore.tsx | 4 +++- 5 files changed, 17 insertions(+), 1 deletion(-) 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 d67f0128b15..bcec59423e3 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -30,6 +30,7 @@ Some stable features are enabled by default. You can disable a stable feature by | `internationalization` | Enables internationalization | Yes | | `accessTokenExpirationCheck` | Enable OAuth access_token expiration check and token refresh using the refresh_token | | | `disablePrometheusExemplarSampling` | Disable Prometheus examplar sampling | | +| `logsSampleInExplore` | Enables access to the logs sample feature in Explore | Yes | ## Beta feature toggles diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 83cbe0d8cc7..467ad96208f 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -92,5 +92,6 @@ export interface FeatureToggles { alertingNoNormalState?: boolean; azureMultipleResourcePicker?: boolean; topNavCommandPalette?: boolean; + logsSampleInExplore?: boolean; logsContextDatasourceUi?: boolean; } diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 72602b93540..6db9cb8d4bc 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -426,6 +426,14 @@ var ( State: FeatureStateBeta, FrontendOnly: true, }, + { + + Name: "logsSampleInExplore", + Description: "Enables access to the logs sample feature in Explore", + State: FeatureStateStable, + Expression: "true", //turned on by default + FrontendOnly: true, + }, { Name: "logsContextDatasourceUi", Description: "Allow datasource to provide custom UI for context view", diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 456ce5e8f3e..617186f858d 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -311,6 +311,10 @@ const ( // Launch the Command Palette from the top navigation search box FlagTopNavCommandPalette = "topNavCommandPalette" + // FlagLogsSampleInExplore + // Enables access to the logs sample feature in Explore + FlagLogsSampleInExplore = "logsSampleInExplore" + // FlagLogsContextDatasourceUi // Allow datasource to provide custom UI for context view FlagLogsContextDatasourceUi = "logsContextDatasourceUi" diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index b99eba23dc6..f4acf60a14d 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -514,7 +514,9 @@ export class Explore extends React.PureComponent { {this.renderFlameGraphPanel()} )} {showTrace && {this.renderTraceViewPanel()}} - {showLogsSample && {this.renderLogsSamplePanel()}} + {config.featureToggles.logsSampleInExplore && showLogsSample && ( + {this.renderLogsSamplePanel()} + )} {showNoData && {this.renderNoData()}} )}