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 278884d76a5..a1c363e4250 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -32,7 +32,6 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general- | `nestedFolders` | Enable folder nesting | 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 | | `influxdbBackendMigration` | Query InfluxDB InfluxQL without the proxy | Yes | | `dataplaneFrontendFallback` | Support dataplane contract field name change for transformations and field name matchers where the name is different | Yes | | `unifiedRequestLog` | Writes error logs to the request logger | Yes | diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 46cebb3309b..b76935732b2 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -53,7 +53,6 @@ export interface FeatureToggles { lokiQuerySplitting?: boolean; lokiQuerySplittingConfig?: boolean; individualCookiePreferences?: boolean; - prometheusMetricEncyclopedia?: boolean; influxdbBackendMigration?: boolean; influxqlStreamingParser?: boolean; influxdbRunQueriesInParallel?: boolean; diff --git a/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.test.tsx b/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.test.tsx index d23fda227f7..c9ff1d55cd2 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.test.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.test.tsx @@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event'; import '@testing-library/jest-dom'; import { DataSourceInstanceSettings, MetricFindValue } from '@grafana/data'; -import { config } from '@grafana/runtime'; import { PrometheusDatasource } from '../../datasource'; import { PromOptions } from '../../types'; @@ -125,29 +124,17 @@ describe('MetricCombobox', () => { expect(mockOnChange).toHaveBeenCalledWith({ metric: 'random_metric', labels: [], operations: [] }); }); - it("doesn't show the metrics explorer button by default", () => { + it('shows the metrics explorer button by default', () => { render(); - expect(screen.queryByRole('button', { name: /open metrics explorer/i })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /open metrics explorer/i })).toBeInTheDocument(); }); - describe('when metrics explorer toggle is enabled', () => { - beforeAll(() => { - jest.replaceProperty(config, 'featureToggles', { - prometheusMetricEncyclopedia: true, - }); - }); + it('opens the metrics explorer when the button is clicked', async () => { + render( Promise.resolve([])} />); - afterAll(() => { - jest.restoreAllMocks(); - }); + const button = screen.getByRole('button', { name: /open metrics explorer/i }); + await userEvent.click(button); - it('opens the metrics explorer when the button is clicked', async () => { - render( Promise.resolve([])} />); - - const button = screen.getByRole('button', { name: /open metrics explorer/i }); - await userEvent.click(button); - - expect(screen.getByText('Metrics explorer')).toBeInTheDocument(); - }); + expect(screen.getByText('Metrics explorer')).toBeInTheDocument(); }); }); diff --git a/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.tsx b/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.tsx index 80c2be2c262..81b3d830779 100644 --- a/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.tsx +++ b/packages/grafana-prometheus/src/querybuilder/components/MetricCombobox.tsx @@ -3,7 +3,6 @@ import { useCallback, useState } from 'react'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { EditorField, EditorFieldGroup, InputGroup } from '@grafana/experimental'; -import { config } from '@grafana/runtime'; import { Button, ComponentSize, InlineField, InlineFieldRow, useStyles2 } from '@grafana/ui'; import { Combobox, ComboboxOption } from '@grafana/ui/src/components/Combobox/Combobox'; import { getPropertiesForButtonSize } from '@grafana/ui/src/components/Forms/commonStyles'; @@ -89,8 +88,6 @@ export function MetricCombobox({ return metrics; }, [onGetMetrics]); - const metricsExplorerEnabled = config.featureToggles.prometheusMetricEncyclopedia; - const styles = useStyles2(getMectricComboboxStyles); const asyncSelect = () => { @@ -105,29 +102,24 @@ export function MetricCombobox({ onChange={onComboboxChange} createCustomValue /> - - {metricsExplorerEnabled ? ( -