Dataplane: feature toggle cleanup dataplane frontend fallback (#113542)
* remove feature toggle dataplaneFrontendFallback because GA * remove feature toggle logic * fix import * fix toggle ownership from merging main * merge main * fix extra feature toggle
This commit is contained in:
@@ -31,7 +31,6 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general-
|
||||
| `logsContextDatasourceUi` | Allow datasource to provide custom UI for context view | Yes |
|
||||
| `lokiQuerySplitting` | Split large interval queries into subqueries with smaller time intervals | 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 |
|
||||
| `logsExploreTableVisualisation` | A table visualisation for logs in Explore | Yes |
|
||||
| `awsDatasourcesTempCredentials` | Support temporary security credentials in AWS plugins for Grafana Cloud customers | Yes |
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
import { toDataFrame } from '../../dataframe/processDataFrame';
|
||||
import { BootData } from '../../types/config';
|
||||
import { DataFrame, FieldType } from '../../types/dataFrame';
|
||||
import { getFieldMatcher } from '../matchers';
|
||||
|
||||
import { FieldMatcherID } from './ids';
|
||||
import { ByNamesMatcherMode } from './nameMatcher';
|
||||
|
||||
window.grafanaBootData = {
|
||||
settings: {
|
||||
featureToggles: {
|
||||
dataplaneFrontendFallback: true,
|
||||
},
|
||||
},
|
||||
} as BootData;
|
||||
|
||||
describe('Field Name by Regexp Matcher', () => {
|
||||
it('Match all with wildcard regex', () => {
|
||||
const seriesWithNames = toDataFrame({
|
||||
|
||||
@@ -107,22 +107,17 @@ const multipleFieldNamesMatcher: FieldMatcherInfo<ByNamesMatcherOptions> = {
|
||||
export function fieldNameFallback(fields: Set<string>) {
|
||||
let fallback: FieldMatcher | undefined = undefined;
|
||||
|
||||
// grafana-data does not have access to runtime so we are accessing the window object
|
||||
// to get access to the feature toggle
|
||||
const useMatcherFallback = window.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback;
|
||||
if (useMatcherFallback) {
|
||||
if (fields.has(TIME_SERIES_VALUE_FIELD_NAME)) {
|
||||
fallback = (field: Field, frame: DataFrame) => {
|
||||
return (
|
||||
Boolean(field.labels) && // Value was reasonable when the name was set in labels or on the frame
|
||||
field.labels?.__name__ === field.name
|
||||
);
|
||||
};
|
||||
} else if (fields.has('Time') || fields.has('time')) {
|
||||
fallback = (field: Field, frame: DataFrame) => {
|
||||
return frame.meta?.typeVersion == null && field.type === FieldType.time;
|
||||
};
|
||||
}
|
||||
if (fields.has(TIME_SERIES_VALUE_FIELD_NAME)) {
|
||||
fallback = (field: Field, frame: DataFrame) => {
|
||||
return (
|
||||
Boolean(field.labels) && // Value was reasonable when the name was set in labels or on the frame
|
||||
field.labels?.__name__ === field.name
|
||||
);
|
||||
};
|
||||
} else if (fields.has('Time') || fields.has('time')) {
|
||||
fallback = (field: Field, frame: DataFrame) => {
|
||||
return frame.meta?.typeVersion == null && field.type === FieldType.time;
|
||||
};
|
||||
}
|
||||
|
||||
return fallback;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { getFieldDisplayName } from '../../field/fieldState';
|
||||
import { DataFrame, Field, FieldType } from '../../types/dataFrame';
|
||||
import {
|
||||
SpecialValue,
|
||||
@@ -26,10 +25,6 @@ const DEFAULT_ROW_FIELD = 'Time';
|
||||
const DEFAULT_VALUE_FIELD = 'Value';
|
||||
const DEFAULT_EMPTY_VALUE = SpecialValue.Empty;
|
||||
|
||||
// grafana-data does not have access to runtime so we are accessing the window object
|
||||
// to get access to the feature toggle
|
||||
const supportDataplaneFallback = window.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback;
|
||||
|
||||
export const groupingToMatrixTransformer: DataTransformerInfo<GroupingToMatrixTransformerOptions> = {
|
||||
id: DataTransformerID.groupingToMatrix,
|
||||
name: 'Grouping to Matrix',
|
||||
@@ -125,7 +120,7 @@ export const groupingToMatrixTransformer: DataTransformerInfo<GroupingToMatrixTr
|
||||
// the column name based on value fields that are numbers
|
||||
// this prevents columns that should be named 1000190
|
||||
// from becoming named {__name__: 'metricName'}
|
||||
if (supportDataplaneFallback && typeof columnName === 'number') {
|
||||
if (typeof columnName === 'number') {
|
||||
valueField.config = { ...valueField.config, displayNameFromDS: undefined };
|
||||
}
|
||||
|
||||
@@ -161,12 +156,8 @@ function findKeyField(frame: DataFrame, matchTitle: string): Field | null {
|
||||
|
||||
// support for dataplane contract with Prometheus and change in location of field name
|
||||
let matches: boolean;
|
||||
if (supportDataplaneFallback) {
|
||||
const matcher = fieldMatchers.get(FieldMatcherID.byName).get(matchTitle);
|
||||
matches = matcher(field, frame, [frame]);
|
||||
} else {
|
||||
matches = matchTitle === getFieldDisplayName(field);
|
||||
}
|
||||
const matcher = fieldMatchers.get(FieldMatcherID.byName).get(matchTitle);
|
||||
matches = matcher(field, frame, [frame]);
|
||||
|
||||
if (matches) {
|
||||
return field;
|
||||
|
||||
@@ -122,11 +122,6 @@ export interface FeatureToggles {
|
||||
*/
|
||||
lokiLogsDataplane?: boolean;
|
||||
/**
|
||||
* Support dataplane contract field name change for transformations and field name matchers where the name is different
|
||||
* @default true
|
||||
*/
|
||||
dataplaneFrontendFallback?: boolean;
|
||||
/**
|
||||
* Disables dataplane specific processing in server side expressions.
|
||||
*/
|
||||
disableSSEDataplane?: boolean;
|
||||
|
||||
@@ -191,15 +191,6 @@ var (
|
||||
Stage: FeatureStageExperimental,
|
||||
Owner: grafanaObservabilityLogsSquad,
|
||||
},
|
||||
{
|
||||
Name: "dataplaneFrontendFallback",
|
||||
Description: "Support dataplane contract field name change for transformations and field name matchers where the name is different",
|
||||
Stage: FeatureStageGeneralAvailability,
|
||||
FrontendOnly: true,
|
||||
Expression: "true",
|
||||
Owner: grafanaObservabilityMetricsSquad,
|
||||
AllowSelfServe: true,
|
||||
},
|
||||
{
|
||||
Name: "disableSSEDataplane",
|
||||
Description: "Disables dataplane specific processing in server side expressions.",
|
||||
|
||||
Generated
-1
@@ -23,7 +23,6 @@ kubernetesStars,experimental,@grafana/grafana-app-platform-squad,false,true,fals
|
||||
influxqlStreamingParser,experimental,@grafana/partner-datasources,false,false,false
|
||||
influxdbRunQueriesInParallel,privatePreview,@grafana/partner-datasources,false,false,false
|
||||
lokiLogsDataplane,experimental,@grafana/observability-logs,false,false,false
|
||||
dataplaneFrontendFallback,GA,@grafana/observability-metrics,false,false,true
|
||||
disableSSEDataplane,experimental,@grafana/grafana-datasources-core-services,false,false,false
|
||||
unifiedRequestLog,GA,@grafana/grafana-backend-group,false,false,false
|
||||
renderAuthJWT,preview,@grafana/grafana-operator-experience-squad,false,false,false
|
||||
|
||||
|
Generated
-4
@@ -103,10 +103,6 @@ const (
|
||||
// Changes logs responses from Loki to be compliant with the dataplane specification.
|
||||
FlagLokiLogsDataplane = "lokiLogsDataplane"
|
||||
|
||||
// FlagDataplaneFrontendFallback
|
||||
// Support dataplane contract field name change for transformations and field name matchers where the name is different
|
||||
FlagDataplaneFrontendFallback = "dataplaneFrontendFallback"
|
||||
|
||||
// FlagDisableSSEDataplane
|
||||
// Disables dataplane specific processing in server side expressions.
|
||||
FlagDisableSSEDataplane = "disableSSEDataplane"
|
||||
|
||||
+3
-1
@@ -1258,7 +1258,8 @@
|
||||
"metadata": {
|
||||
"name": "dataplaneFrontendFallback",
|
||||
"resourceVersion": "1753448760331",
|
||||
"creationTimestamp": "2023-04-07T21:13:19Z"
|
||||
"creationTimestamp": "2023-04-07T21:13:19Z",
|
||||
"deletionTimestamp": "2025-11-06T17:39:31Z"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Support dataplane contract field name change for transformations and field name matchers where the name is different",
|
||||
@@ -4088,6 +4089,7 @@
|
||||
"name": "timeRangePan",
|
||||
"resourceVersion": "1762290731154",
|
||||
"creationTimestamp": "2025-10-24T19:49:53Z",
|
||||
"deletionTimestamp": "2025-11-06T17:39:31Z",
|
||||
"annotations": {
|
||||
"grafana.app/updatedTimestamp": "2025-11-04 21:12:11.154822 +0000 UTC"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user