Skip to content

Commit

Permalink
Clean up the feature flags (#1900)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzmadom authored Dec 9, 2024
1 parent bcc0e0b commit 9d5e656
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 37 deletions.
10 changes: 0 additions & 10 deletions src/server/components/features/features-list/ChartWithFnLogging.ts

This file was deleted.

23 changes: 2 additions & 21 deletions src/server/modes/charts/init-charts-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import type {AppConfig, AppContext} from '@gravity-ui/nodekit';
import get from 'lodash/get';
import sizeof from 'object-sizeof';

import {
AppEnvironment,
Feature,
isEnabledServerFeature,
isObjectWithFunction,
} from '../../../shared';
import {AppEnvironment} from '../../../shared';
import CacheClient from '../../components/cache-client';
import {ChartsEngine} from '../../components/charts-engine';
import {getDefaultRunners} from '../../components/charts-engine/runners';
Expand All @@ -30,7 +25,6 @@ export function initChartsEngine({
afterAuth: AppMiddleware[];
}) {
const getTime = () => new Date().toISOString().replace('T', ' ').split('.')[0];
const shouldLogChartWithFunction = isEnabledServerFeature(ctx, Feature.ChartWithFnLogging);

const telemetryCallbacks: TelemetryCallbacks = {
onConfigFetched: ({id, statusCode, requestId, latency = 0, traceId, tenantId, userId}) => {
Expand Down Expand Up @@ -116,23 +110,10 @@ export function initChartsEngine({
},

onTabsExecuted: ({result, entryId}) => {
const {
config: chartConfig,
highchartsConfig,
sources,
sourceData,
processedData,
} = result;
const {sources, sourceData, processedData} = result;
const chartEntryId = entryId || '';
const datetime = Date.now();

if (
shouldLogChartWithFunction &&
(isObjectWithFunction(chartConfig) || isObjectWithFunction(highchartsConfig))
) {
ctx.stats('chartsWithFn', {datetime, entryId: chartEntryId});
}

let rowsCount = 0;
let columnsCount = 0;
if (sourceData && typeof sourceData === 'object') {
Expand Down
5 changes: 0 additions & 5 deletions src/shared/modules/charts-shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {dateTime, dateTimeParse} from '@gravity-ui/date-utils';
import type {DurationUnit} from '@gravity-ui/date-utils';
import isFunction from 'lodash/isFunction';

import type {ServerDatasetField} from '../types';

Expand Down Expand Up @@ -349,7 +348,3 @@ export function isObjectWith(

return false;
}

export function isObjectWithFunction(value: unknown) {
return isObjectWith(value, isFunction, []);
}
6 changes: 5 additions & 1 deletion src/shared/types/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export enum Feature {
FetchDocumentation = 'FetchDocumentation',
Comments = 'Comments',
EmptySelector = 'emptySelector',
// Check access rights when processing ChartEditor charts
ChartEditorDeveloperModeCheck = 'ChartEditorDeveloperModeCheck',
QLPrometheus = 'QLPrometheus',
QLMonitoring = 'QLMonitoring',
Expand All @@ -28,13 +29,17 @@ export enum Feature {
DashBoardSupportDescription = 'DashBoardSupportDescription',
DashAutorefresh = 'DashAutorefresh',
GSheetsV2Enabled = 'GSheetsV2Enabled',
// Show request body in the Inspector dialog
ShowInspectorDetails = 'ShowInspectorDetails',
// Prohibiting the serialization of functions in the chart configs
NoJsonFn = 'NoJsonFn',
GSheetGoogleAuthEnabled = 'GSheetGoogleAuthEnabled',
DatasetsRLS = 'DatasetsRLS',
// The ability to upload xlsx files for file connections
XlsxFilesEnabled = 'XlsxFilesEnabled',
XlsxChartExportEnabled = 'XlsxChartExportEnabled',
GroupControls = 'GroupControls',
// Escaping field values in chart tooltips (only scatter, treemap, geopoints visualizations)
EscapeUserHtmlInDefaultHcTooltip = 'EscapeUserHtmlInDefaultHcTooltip',
HolidaysOnChart = 'HolidaysOnChart',
ReadOnlyMode = 'ReadOnlyMode',
Expand All @@ -59,7 +64,6 @@ export enum Feature {
MultipleColorsInVisualization = 'MultipleColorsInVisualization',
ConnectionBasedControl = 'ConnectionBasedControl',
EnableServerlessEditor = 'EnableServerlessEditor',
ChartWithFnLogging = 'ChartWithFnLogging',
EnableFooter = 'EnableFooter',
MassRemoveCollectionsWorkbooks = 'MassRemoveCollectionsWorkbooks',
/* Enable dashboard fixed header */
Expand Down

0 comments on commit 9d5e656

Please sign in to comment.