Prometheus: Fuzzy search for metric names in Code Mode (#85396)

* perf: limit metric names in Code Mode suggestions

* feat: configurable metric names limit

* feat: code mode autocomplete info/disclaimer

* chore: put new functionality behind new feature toggle

* refactor: avoid type assertions

* refactor: avoid explicit `any`

refactor: type guards

* refactor: type guards

* chore: add testdata results

* fix: add missing feature toggle guard

* perf: prefer array access to `Array.prototype.at`

* test: add missing config override

* test: refactor for brevity & clarity

* perf: avoid unnecessary mapping

* chore: undo testdata changes

* fix: use correct limit; perf optimizations

* refactor: avoid unnecessary `async`s

* types: simplify

* test: add missing tests

* fix: avoid hardcoding

* test: update mock path

* docs: fix typo

style: remove formatting artifact

style: remove formatting artifact

style: remove formatting artifact

* fix: event scope regression

* style: refactor for clarity

* refactor: prefer `useCallback` to in-effect handler

* refactor: simplify & broaden `filter`

* refactor: rename file to keep with conventions

* chore: mirror Prometheus package changes in app

* refactor: prefer no `@ts-ignore`

* chore: update betterer results

* docs: use type in TSDoc `@link` without `@ts-ignore`

* test: add missing provider

* test: fix jest mock path

* fix: display disclaimer in empty input case
This commit is contained in:
Nick Richmond
2024-04-04 23:38:23 +03:00
committed by GitHub
parent 0d7834c7f7
commit 559fab9dc6
32 changed files with 1292 additions and 132 deletions
+7
View File
@@ -859,6 +859,13 @@ var (
FrontendOnly: true,
Owner: grafanaObservabilityMetricsSquad,
},
{
Name: "prometheusCodeModeMetricNamesSearch",
Description: "Enables search for metric names in Code Mode, to improve performance when working with an enormous number of metric names",
FrontendOnly: true,
Stage: FeatureStageExperimental,
Owner: grafanaObservabilityMetricsSquad,
},
{
Name: "addFieldFromCalculationStatFunctions",
Description: "Add cumulative and window functions to the add field from calculation transformation",
+1
View File
@@ -114,6 +114,7 @@ cachingOptimizeSerializationMemoryUsage,experimental,@grafana/grafana-operator-e
panelTitleSearchInV1,experimental,@grafana/backend-platform,true,false,false
managedPluginsInstall,GA,@grafana/plugins-platform-backend,false,false,false
prometheusPromQAIL,experimental,@grafana/observability-metrics,false,false,true
prometheusCodeModeMetricNamesSearch,experimental,@grafana/observability-metrics,false,false,true
addFieldFromCalculationStatFunctions,preview,@grafana/dataviz-squad,false,false,true
alertmanagerRemoteSecondary,experimental,@grafana/alerting-squad,false,false,false
alertmanagerRemotePrimary,experimental,@grafana/alerting-squad,false,false,false
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
114 panelTitleSearchInV1 experimental @grafana/backend-platform true false false
115 managedPluginsInstall GA @grafana/plugins-platform-backend false false false
116 prometheusPromQAIL experimental @grafana/observability-metrics false false true
117 prometheusCodeModeMetricNamesSearch experimental @grafana/observability-metrics false false true
118 addFieldFromCalculationStatFunctions preview @grafana/dataviz-squad false false true
119 alertmanagerRemoteSecondary experimental @grafana/alerting-squad false false false
120 alertmanagerRemotePrimary experimental @grafana/alerting-squad false false false
+4
View File
@@ -467,6 +467,10 @@ const (
// Prometheus and AI/ML to assist users in creating a query
FlagPrometheusPromQAIL = "prometheusPromQAIL"
// FlagPrometheusCodeModeMetricNamesSearch
// Enables search for metric names in Code Mode, to improve performance when working with an enormous number of metric names
FlagPrometheusCodeModeMetricNamesSearch = "prometheusCodeModeMetricNamesSearch"
// FlagAddFieldFromCalculationStatFunctions
// Add cumulative and window functions to the add field from calculation transformation
FlagAddFieldFromCalculationStatFunctions = "addFieldFromCalculationStatFunctions"
+13
View File
@@ -2107,6 +2107,19 @@
"hideFromAdminPage": true,
"hideFromDocs": true
}
},
{
"metadata": {
"name": "prometheusCodeModeMetricNamesSearch",
"resourceVersion": "1712241392690",
"creationTimestamp": "2024-04-04T14:36:32Z"
},
"spec": {
"description": "Enables search for metric names in Code Mode, to improve performance when working with an enormous number of metric names",
"stage": "experimental",
"codeowner": "@grafana/observability-metrics",
"frontend": true
}
}
]
}