Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Step 1 ] VisEditors Telemetry enhancements (remove legacy agg-based telemetries) #135634

Merged
merged 6 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 0 additions & 116 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10112,122 +10112,6 @@
}
}
}
},
"vis_type_table": {
"properties": {
"total": {
"type": "long"
},
"total_split": {
"type": "long"
},
"split_columns": {
"properties": {
"total": {
"type": "long"
},
"enabled": {
"type": "long"
}
}
},
"split_rows": {
"properties": {
"total": {
"type": "long"
},
"enabled": {
"type": "long"
}
}
}
}
},
"vis_type_timeseries": {
"properties": {
"timeseries_use_last_value_mode_total": {
"type": "long",
"_meta": {
"description": "Number of TSVB visualizations using \"last value\" as a time range"
}
},
"timeseries_use_es_indices_total": {
"type": "long",
"_meta": {
"description": "Number of TSVB visualizations using elasticsearch indices"
}
},
"timeseries_table_use_aggregate_function": {
"type": "long",
"_meta": {
"description": "Number of TSVB table visualizations using aggregate function"
}
},
"timeseries_types": {
"properties": {
"table": {
"type": "long"
},
"gauge": {
"type": "long"
},
"markdown": {
"type": "long"
},
"top_n": {
"type": "long"
},
"timeseries": {
"type": "long"
},
"metric": {
"type": "long"
}
}
}
}
},
"vis_type_vega": {
"properties": {
"vega_lib_specs_total": {
"type": "long"
},
"vega_lite_lib_specs_total": {
"type": "long"
},
"vega_use_map_total": {
"type": "long"
}
}
},
"visualization_types": {
"properties": {
"DYNAMIC_KEY": {
"properties": {
"total": {
"type": "long"
},
"spaces_min": {
"type": "long"
},
"spaces_max": {
"type": "long"
},
"spaces_avg": {
"type": "long"
},
"saved_7_days_total": {
"type": "long"
},
"saved_30_days_total": {
"type": "long"
},
"saved_90_days_total": {
"type": "long"
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ import { HeatmapVisParams, HeatmapTypeProps } from '../../types';
const HeatmapOptionsLazy = lazy(() => import('./heatmap'));

export const getHeatmapOptions =
({ showElasticChartsOptions, palettes, trackUiMetric }: HeatmapTypeProps) =>
({ showElasticChartsOptions, palettes }: HeatmapTypeProps) =>
(props: VisEditorOptionsProps<HeatmapVisParams>) =>
(
<HeatmapOptionsLazy
{...props}
palettes={palettes}
showElasticChartsOptions={showElasticChartsOptions}
trackUiMetric={trackUiMetric}
/>
);
6 changes: 0 additions & 6 deletions src/plugins/vis_types/heatmap/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,10 @@ export class VisTypeHeatmapPlugin {
{ visualizations, charts, usageCollection }: VisTypeHeatmapSetupDependencies
) {
if (!core.uiSettings.get(LEGACY_HEATMAP_CHARTS_LIBRARY)) {
const trackUiMetric = usageCollection?.reportUiCounter.bind(
usageCollection,
'vis_type_heatmap'
);

visualizations.createBaseVisualization(
heatmapVisType({
showElasticChartsOptions: true,
palettes: charts.palettes,
trackUiMetric,
})
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/vis_types/heatmap/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { UiCounterMetricType } from '@kbn/analytics';
import type { Position } from '@elastic/charts';
import type { ChartsPluginSetup, Style, Labels, ColorSchemas } from '@kbn/charts-plugin/public';
import { Range } from '@kbn/expressions-plugin/public';
Expand All @@ -14,7 +13,6 @@ import { LegendSize } from '@kbn/visualizations-plugin/public';
export interface HeatmapTypeProps {
showElasticChartsOptions?: boolean;
palettes?: ChartsPluginSetup['palettes'];
trackUiMetric?: (metricType: UiCounterMetricType, eventName: string | string[]) => void;
}

export interface HeatmapVisParams {
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/vis_types/heatmap/public/vis_type/heatmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { SplitTooltip } from './split_tooltip';
export const getHeatmapVisTypeDefinition = ({
showElasticChartsOptions = false,
palettes,
trackUiMetric,
}: HeatmapTypeProps): VisTypeDefinition<HeatmapVisParams> => ({
name: 'heatmap',
title: i18n.translate('visTypeHeatmap.heatmap.heatmapTitle', { defaultMessage: 'Heat map' }),
Expand Down Expand Up @@ -68,7 +67,6 @@ export const getHeatmapVisTypeDefinition = ({
optionsTemplate: getHeatmapOptions({
showElasticChartsOptions,
palettes,
trackUiMetric,
}),
schemas: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import { PieTypeProps } from '../../types';
const PieOptionsLazy = lazy(() => import('./pie'));

export const getPieOptions =
({ showElasticChartsOptions, palettes, trackUiMetric }: PieTypeProps) =>
({ showElasticChartsOptions, palettes }: PieTypeProps) =>
(props: VisEditorOptionsProps<PartitionVisParams>) =>
(
<PieOptionsLazy
{...props}
palettes={palettes}
showElasticChartsOptions={showElasticChartsOptions}
trackUiMetric={trackUiMetric}
/>
);
13 changes: 0 additions & 13 deletions src/plugins/vis_types/pie/public/editor/components/pie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import React, { useState, useEffect, useCallback } from 'react';
import { METRIC_TYPE } from '@kbn/analytics';
import {
EuiPanel,
EuiTitle,
Expand Down Expand Up @@ -223,9 +222,6 @@ const PieOptions = (props: PieOptionsProps) => {
value={stateParams.nestedLegend}
disabled={stateParams.legendDisplay === LegendDisplay.HIDE}
setValue={(paramName, value) => {
if (props.trackUiMetric) {
props.trackUiMetric(METRIC_TYPE.CLICK, 'nested_legend_switched');
}
setValue(paramName, value);
}}
data-test-subj="visTypePieNestedLegendSwitch"
Expand Down Expand Up @@ -253,9 +249,6 @@ const PieOptions = (props: PieOptionsProps) => {
activePalette={stateParams.palette}
paramName="palette"
setPalette={(paramName, value) => {
if (props.trackUiMetric) {
props.trackUiMetric(METRIC_TYPE.CLICK, 'palette_selected');
}
setValue(paramName, value);
}}
/>
Expand Down Expand Up @@ -296,9 +289,6 @@ const PieOptions = (props: PieOptionsProps) => {
: stateParams.labels.position || LabelPositions.DEFAULT
}
setValue={(paramName, value) => {
if (props.trackUiMetric) {
props.trackUiMetric(METRIC_TYPE.CLICK, 'label_position_selected');
}
setLabels(paramName, value);
}}
data-test-subj="visTypePieLabelPositionSelect"
Expand Down Expand Up @@ -338,9 +328,6 @@ const PieOptions = (props: PieOptionsProps) => {
paramName="valuesFormat"
value={stateParams.labels.valuesFormat || ValueFormats.PERCENT}
setValue={(paramName, value) => {
if (props.trackUiMetric) {
props.trackUiMetric(METRIC_TYPE.CLICK, 'values_format_selected');
}
setLabels(paramName, value);
}}
data-test-subj="visTypePieValueFormatsSelect"
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/vis_types/pie/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ export class VisTypePiePlugin {
{ visualizations, charts, usageCollection }: VisTypePieSetupDependencies
) {
if (!core.uiSettings.get(LEGACY_PIE_CHARTS_LIBRARY, false)) {
const trackUiMetric = usageCollection?.reportUiCounter.bind(usageCollection, 'vis_type_pie');
visualizations.createBaseVisualization(
pieVisType({
showElasticChartsOptions: true,
palettes: charts.palettes,
trackUiMetric,
})
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/vis_types/pie/public/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import { UiCounterMetricType } from '@kbn/analytics';
import { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';
import { ChartsPluginSetup } from '@kbn/charts-plugin/public';

Expand All @@ -28,5 +27,4 @@ export interface Dimensions {
export interface PieTypeProps {
showElasticChartsOptions?: boolean;
palettes?: ChartsPluginSetup['palettes'];
trackUiMetric?: (metricType: UiCounterMetricType, eventName: string | string[]) => void;
}
2 changes: 0 additions & 2 deletions src/plugins/vis_types/pie/public/vis_type/pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { getPieOptions } from '../editor/components';
export const getPieVisTypeDefinition = ({
showElasticChartsOptions = false,
palettes,
trackUiMetric,
}: PieTypeProps): VisTypeDefinition<PartitionVisParams> => ({
name: 'pie',
title: i18n.translate('visTypePie.pie.pieTitle', { defaultMessage: 'Pie' }),
Expand Down Expand Up @@ -68,7 +67,6 @@ export const getPieVisTypeDefinition = ({
optionsTemplate: getPieOptions({
showElasticChartsOptions,
palettes,
trackUiMetric,
}),
schemas: [
{
Expand Down
1 change: 0 additions & 1 deletion src/plugins/vis_types/table/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"share",
"visDefaultEditor"
],
"optionalPlugins": ["usageCollection"],
"owner": {
"name": "Vis Editors",
"githubTeam": "kibana-vis-editors"
Expand Down
11 changes: 2 additions & 9 deletions src/plugins/vis_types/table/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@
* Side Public License, v 1.
*/

import { CoreSetup, PluginConfigDescriptor } from '@kbn/core/server';
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';

import { PluginConfigDescriptor } from '@kbn/core/server';
import { configSchema, ConfigSchema } from '../config';
import { registerVisTypeTableUsageCollector } from './usage_collector';

export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
};

export const plugin = () => ({
setup(core: CoreSetup, plugins: { usageCollection?: UsageCollectionSetup }) {
if (plugins.usageCollection) {
registerVisTypeTableUsageCollector(plugins.usageCollection);
}
},
setup() {},
start() {},
});
Loading