Transformations: GA the Regression transformation (#106074)

* First draft of removing flag, regenerating flags and content

* Add description to catalog entry

* fix gdev dashboard
pull/107156/head
Kristina 3 weeks ago committed by GitHub
parent da7b83c1bb
commit f460e02913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 123
      devenv/dev-dashboards/transforms/regression-analysis.json
  2. 2
      docs/sources/panels-visualizations/query-transform-data/transform-data/index.md
  3. 1
      docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
  4. 4
      packages/grafana-data/src/types/featureToggles.gen.ts
  5. 7
      pkg/services/featuremgmt/registry.go
  6. 1
      pkg/services/featuremgmt/toggles_gen.csv
  7. 4
      pkg/services/featuremgmt/toggles_gen.go
  8. 3
      pkg/services/featuremgmt/toggles_gen.json
  9. 2
      public/app/features/transformers/docs/content.ts
  10. 1
      public/app/features/transformers/regression/regression.ts
  11. 2
      public/app/features/transformers/standardTransformers.ts

@ -39,6 +39,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@ -70,7 +71,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -96,10 +97,12 @@
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0-pre",
"targets": [
{
"datasource": {
@ -144,6 +147,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@ -175,7 +179,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -201,10 +205,12 @@
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0-pre",
"targets": [
{
"datasource": {
@ -248,6 +254,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@ -279,7 +286,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -305,11 +312,12 @@
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.3.0-pre",
"pluginVersion": "12.1.0-pre",
"targets": [
{
"csvContent": "time, val\n2023-11-20 12:09:00, 1\n2023-11-20 12:09:02, 2\n2023-11-20 12:09:03, 3\n2023-11-20 12:09:04, 4\n2023-11-20 12:09:05, 5\n2023-11-20 12:09:06, 6\n2023-11-20 12:09:07, 2\n2023-11-20 12:09:08, 3\n2023-11-20 12:09:09, 4\n2023-11-20 12:09:10, 1\n2023-11-20 12:09:11, 2\n2023-11-20 12:09:12, 3\n2023-11-20 12:09:13, 4",
@ -328,6 +336,7 @@
"options": {
"conversions": [
{
"dateFormat": "YYYY-MM-DD hh:mm:ss",
"destinationType": "time",
"targetField": "time"
}
@ -374,6 +383,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@ -405,7 +415,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -431,10 +441,12 @@
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0-pre",
"targets": [
{
"csvContent": "time, val\n2023-11-20 12:09:00, 1\n2023-11-20 12:09:02, 2\n2023-11-20 12:09:03, 3\n2023-11-20 12:09:04, 4\n2023-11-20 12:09:05, null\n2023-11-20 12:09:06, 6\n2023-11-20 12:09:07, 2\n2023-11-20 12:09:08, null\n2023-11-20 12:09:09, 4\n2023-11-20 12:09:10, 1\n2023-11-20 12:09:11, 2\n2023-11-20 12:09:12, 3\n2023-11-20 12:09:13, 4",
@ -453,6 +465,7 @@
"options": {
"conversions": [
{
"dateFormat": "YYYY-MM-DD hh:mm:ss",
"destinationType": "time",
"targetField": "time"
}
@ -499,14 +512,17 @@
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 50,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"pointShape": "circle",
"pointSize": {
"fixed": 5
},
"pointStrokeWidth": 1,
"scaleDistribution": {
"type": "linear"
},
@ -518,7 +534,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -562,22 +578,42 @@
},
"id": 3,
"options": {
"dims": {
"frame": 0
},
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"series": [],
"seriesMapping": "auto",
"mapping": "auto",
"series": [
{
"frame": {
"matcher": {
"id": "byIndex",
"options": 0
}
},
"x": {
"matcher": {
"id": "byType",
"options": "number"
}
},
"y": {
"matcher": {
"id": "byType",
"options": "number"
}
}
}
],
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.1.0-pre",
"targets": [
{
"csvContent": "x,y\n1,4\n2,1\n3,2\n4,-2\n5,6\n3,2\n1,7\n3,9\n6,3\n5,-3\n2,-2\n7,15",
@ -654,7 +690,7 @@
"steps": [
{
"color": "green",
"value": null
"value": 0
},
{
"color": "red",
@ -677,6 +713,7 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
@ -684,10 +721,16 @@
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.3.0-pre",
"pluginVersion": "12.1.0-pre",
"targets": [
{
"refId": "A"
}
],
"title": "stat panel",
"transformations": [
{
@ -728,6 +771,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@ -758,7 +802,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": 0
},
{
"color": "red",
@ -809,11 +854,12 @@
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.3.0-pre",
"pluginVersion": "12.1.0-pre",
"targets": [
{
"csvContent": "x, val\n6,2\n8,1\n10,5\n15,1\n22,10\n",
@ -877,14 +923,17 @@
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 50,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"pointShape": "circle",
"pointSize": {
"fixed": 5
},
"pointStrokeWidth": 1,
"scaleDistribution": {
"type": "linear"
},
@ -895,7 +944,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": 0
},
{
"color": "red",
@ -939,37 +989,42 @@
},
"id": 8,
"options": {
"dims": {
"exclude": [],
"frame": 0,
"x": "foo"
},
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"mapping": "auto",
"series": [
{
"pointColor": {},
"pointSize": {
"field": "baz",
"fixed": 50.5,
"max": 100,
"min": 1
"frame": {
"matcher": {
"id": "byIndex",
"options": 0
}
},
"x": {
"matcher": {
"id": "byName",
"options": "foo"
}
},
"x": "foo",
"y": "foo"
"y": {
"matcher": {
"id": "byType",
"options": "number"
}
}
}
],
"seriesMapping": "auto",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "10.3.0-pre",
"pluginVersion": "12.1.0-pre",
"targets": [
{
"datasource": {
@ -1014,8 +1069,9 @@
"type": "xychart"
}
],
"preload": false,
"refresh": "",
"schemaVersion": 39,
"schemaVersion": 41,
"tags": [
"gdev",
"transform"
@ -1031,6 +1087,5 @@
"timezone": "",
"title": "Transforms - Regression analysis",
"uid": "d2d2bb99-42e4-44b8-b93e-3ad1aae31c6b",
"version": 39,
"weekStart": ""
"version": 1
}

@ -1484,8 +1484,6 @@ There are two different models:
- **Polynomial regression** - Fits a polynomial function to the data.
{{< figure src="/static/img/docs/transformations/polynomial-regression.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series visualization with a curved line representing the polynomial function" >}}
> **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the `regressionTransformation` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud.
[Table panel]: ref:table-panel
[Calculation types]: ref:calculation-types
[sparkline cell type]: ref:sparkline-cell-type

@ -103,7 +103,6 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general-
| `cloudWatchBatchQueries` | Runs CloudWatch metrics queries as separate batches |
| `pdfTables` | Enables generating table data as PDF in reporting |
| `canvasPanelPanZoom` | Allow pan and zoom in canvas panel |
| `regressionTransformation` | Enables regression analysis transformation |
| `alertingSaveStateCompressed` | Enables the compressed protobuf-based alert state storage |
| `tableNextGen` | Allows access to the new react-data-grid based table component. |
| `enableSCIM` | Enables SCIM support for user and group management |

@ -420,10 +420,6 @@ export interface FeatureToggles {
*/
tableSharedCrosshair?: boolean;
/**
* Enables regression analysis transformation
*/
regressionTransformation?: boolean;
/**
* Enables query hints for Loki
* @default true
*/

@ -697,13 +697,6 @@ var (
Stage: FeatureStageExperimental,
Owner: grafanaDatavizSquad,
},
{
Name: "regressionTransformation",
Description: "Enables regression analysis transformation",
Stage: FeatureStagePublicPreview,
FrontendOnly: true,
Owner: grafanaDatavizSquad,
},
{
// this is mainly used as a way to quickly disable query hints as a safeguard for our infrastructure
Name: "lokiQueryHints",

@ -92,7 +92,6 @@ logsInfiniteScrolling,GA,@grafana/observability-logs,false,false,true
logRowsPopoverMenu,GA,@grafana/observability-logs,false,false,true
pluginsSkipHostEnvVars,experimental,@grafana/plugins-platform-backend,false,false,false
tableSharedCrosshair,experimental,@grafana/dataviz-squad,false,false,true
regressionTransformation,preview,@grafana/dataviz-squad,false,false,true
lokiQueryHints,GA,@grafana/observability-logs,false,false,true
kubernetesFeatureToggles,experimental,@grafana/grafana-operator-experience-squad,false,false,true
cloudRBACRoles,preview,@grafana/identity-access-team,false,true,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
92 logRowsPopoverMenu GA @grafana/observability-logs false false true
93 pluginsSkipHostEnvVars experimental @grafana/plugins-platform-backend false false false
94 tableSharedCrosshair experimental @grafana/dataviz-squad false false true
regressionTransformation preview @grafana/dataviz-squad false false true
95 lokiQueryHints GA @grafana/observability-logs false false true
96 kubernetesFeatureToggles experimental @grafana/grafana-operator-experience-squad false false true
97 cloudRBACRoles preview @grafana/identity-access-team false true false

@ -379,10 +379,6 @@ const (
// Enables shared crosshair in table panel
FlagTableSharedCrosshair = "tableSharedCrosshair"
// FlagRegressionTransformation
// Enables regression analysis transformation
FlagRegressionTransformation = "regressionTransformation"
// FlagLokiQueryHints
// Enables query hints for Loki
FlagLokiQueryHints = "lokiQueryHints"

@ -2615,7 +2615,8 @@
"metadata": {
"name": "regressionTransformation",
"resourceVersion": "1750434297879",
"creationTimestamp": "2023-11-24T14:49:16Z"
"creationTimestamp": "2023-11-24T14:49:16Z",
"deletionTimestamp": "2025-07-01T13:24:02Z"
},
"spec": {
"description": "Enables regression analysis transformation",

@ -1595,8 +1595,6 @@ ${buildImageContent(
imageRenderType,
'A time series visualization with a curved line representing the polynomial function'
)}
> **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the \`regressionTransformation\` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud.
`;
},
},

@ -38,6 +38,7 @@ export const DEGREES = [
export const RegressionTransformer: SynchronousDataTransformerInfo<RegressionTransformerOptions> = {
id: DataTransformerID.regression,
name: 'Regression analysis',
description: 'Create a new data frame containing values predicted by a statistical model.',
operator: (options, ctx) => (source) =>
source.pipe(map((data) => RegressionTransformer.transformer(options, ctx)(data))),
transformer: (options, ctx) => {

@ -63,9 +63,9 @@ export const getStandardTransformers = (): TransformerRegistryItem[] => {
groupingToMatrixTransformRegistryItem,
limitTransformRegistryItem,
joinByLabelsTransformRegistryItem,
regressionTransformerRegistryItem,
partitionByValuesTransformRegistryItem,
...(config.featureToggles.formatString ? [formatStringTransformerRegistryItem] : []),
...(config.featureToggles.regressionTransformation ? [regressionTransformerRegistryItem] : []),
...(config.featureToggles.groupToNestedTableTransformation ? [groupToNestedTableTransformRegistryItem] : []),
formatTimeTransformerRegistryItem,
timeSeriesTableTransformRegistryItem,

Loading…
Cancel
Save