Skip to content

Commit

Permalink
Merge branch 'master' into feature/85517
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Dec 28, 2020
2 parents 1614dc1 + c0d6e12 commit c35e4c0
Show file tree
Hide file tree
Showing 193 changed files with 3,443 additions and 40,254 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
"url-loader": "^2.2.0",
"use-resize-observer": "^6.0.0",
"val-loader": "^1.1.1",
"vega": "^5.17.1",
"vega": "^5.17.3",
"vega-lite": "^4.17.0",
"vega-schema-url-parser": "^2.1.0",
"vega-tooltip": "^0.24.2",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_xy/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["charts", "data", "expressions", "visualizations"],
"requiredPlugins": ["charts", "data", "expressions", "visualizations", "usageCollection"],
"requiredBundles": ["kibanaUtils", "visDefaultEditor"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
import React from 'react';

import { i18n } from '@kbn/i18n';
import { METRIC_TYPE } from '@kbn/analytics';

import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public';

import { ChartType } from '../../../../../common';
import { VisParams } from '../../../../types';
import { ValidationVisOptionsProps } from '../../common';
import { getTrackUiMetric } from '../../../../services';

export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>) {
const trackUiMetric = getTrackUiMetric();
const { stateParams, setValue, vis, aggs } = props;

const hasLineChart = stateParams.seriesParams.some(
Expand All @@ -49,7 +52,12 @@ export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>
})}
paramName="detailedTooltip"
value={stateParams.detailedTooltip}
setValue={setValue}
setValue={(paramName, value) => {
if (trackUiMetric) {
trackUiMetric(METRIC_TYPE.CLICK, 'detailed_tooltip_switched');
}
setValue(paramName, value);
}}
/>

{hasLineChart && (
Expand All @@ -61,7 +69,12 @@ export function ElasticChartsOptions(props: ValidationVisOptionsProps<VisParams>
options={vis.type.editorConfig.collections.fittingFunctions}
paramName="fittingFunction"
value={stateParams.fittingFunction}
setValue={setValue}
setValue={(paramName, value) => {
if (trackUiMetric) {
trackUiMetric(METRIC_TYPE.CLICK, 'fitting_function_selected');
}
setValue(paramName, value);
}}
/>
)}
</>
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/vis_type_xy/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public';
import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public';
import { ChartsPluginSetup } from '../../charts/public';
import { DataPublicPluginStart } from '../../data/public';
import { UsageCollectionSetup } from '../../usage_collection/public';

import { createVisTypeXyVisFn } from './xy_vis_fn';
import {
Expand All @@ -32,6 +33,7 @@ import {
setTimefilter,
setUISettings,
setDocLinks,
setTrackUiMetric,
} from './services';
import { visTypesDefinitions } from './vis_types';
import { LEGACY_CHARTS_LIBRARY } from '../common';
Expand All @@ -47,6 +49,7 @@ export interface VisTypeXyPluginSetupDependencies {
expressions: ReturnType<ExpressionsPublicPlugin['setup']>;
visualizations: VisualizationsSetup;
charts: ChartsPluginSetup;
usageCollection: UsageCollectionSetup;
}

/** @internal */
Expand All @@ -69,7 +72,7 @@ export class VisTypeXyPlugin
> {
public async setup(
core: VisTypeXyCoreSetup,
{ expressions, visualizations, charts }: VisTypeXyPluginSetupDependencies
{ expressions, visualizations, charts, usageCollection }: VisTypeXyPluginSetupDependencies
) {
if (!core.uiSettings.get(LEGACY_CHARTS_LIBRARY, false)) {
setUISettings(core.uiSettings);
Expand All @@ -81,6 +84,8 @@ export class VisTypeXyPlugin
visTypesDefinitions.forEach(visualizations.createBaseVisualization);
}

setTrackUiMetric(usageCollection?.reportUiCounter.bind(usageCollection, 'vis_type_xy'));

return {};
}

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/vis_type_xy/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/

import { UiCounterMetricType } from '@kbn/analytics';
import { CoreSetup, DocLinksStart } from '../../../core/public';
import { createGetterSetter } from '../../kibana_utils/public';
import { DataPublicPluginStart } from '../../data/public';
Expand Down Expand Up @@ -47,3 +48,7 @@ export const [getColorsService, setColorsService] = createGetterSetter<
>('xy charts.color');

export const [getDocLinks, setDocLinks] = createGetterSetter<DocLinksStart>('DocLinks');

export const [getTrackUiMetric, setTrackUiMetric] = createGetterSetter<
(metricType: UiCounterMetricType, eventName: string | string[]) => void
>('trackUiMetric');
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('KeyUXMetrics', () => {
<KeyUXMetrics
loading={false}
data={{
cls: '0.01',
cls: 0.01,
fid: 6,
lcp: 1701.1142857142856,
tbt: 270.915,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { APIReturnType } from '../../../../../services/rest/createCallApmApi';

type ServiceListAPIResponse = APIReturnType<'GET /api/apm/services'>;

export const items: ServiceListAPIResponse['items'] = [
{
serviceName: 'opbeans-node',
transactionType: 'request',
agentName: 'nodejs',
transactionsPerMinute: { value: 0, timeseries: [] },
transactionErrorRate: { value: 46.06666666666667, timeseries: [] },
avgResponseTime: { value: null, timeseries: [] },
environments: ['test'],
},
{
serviceName: 'opbeans-python',
transactionType: 'page-load',
agentName: 'python',
transactionsPerMinute: { value: 86.93333333333334, timeseries: [] },
transactionErrorRate: { value: 12.6, timeseries: [] },
avgResponseTime: { value: 91535.42944785276, timeseries: [] },
environments: [],
},
];
Loading

0 comments on commit c35e4c0

Please sign in to comment.