Skip to content

Commit

Permalink
Merge branch 'main' into cleanupVisualize_embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 18, 2022
2 parents 8ccbff6 + 88354aa commit 57ad263
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .buildkite/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fi
### upload ts-refs-cache artifacts as quickly as possible so they are available for download
###
if [[ "${BUILD_TS_REFS_CACHE_CAPTURE:-}" == "true" ]]; then
echo "--- Build ts-refs-cache"
node scripts/build_ts_refs.js --ignore-type-failures
echo "--- Upload ts-refs-cache"
cd "$KIBANA_DIR/target/ts_refs_cache"
gsutil cp "*.zip" 'gs://kibana-ci-ts-refs-cache/'
Expand Down
2 changes: 1 addition & 1 deletion dev_docs/key_concepts/building_blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ sharing and space isolation, and tags.

## Advanced Settings

<DocLink id="kibDevTutorialAdvancedSettings" text="Advanced Settings and the uiSettings service /> should be used if you need to add application-level configuration options. If you wanted to add a setting for listing a number of items per page in your TODO application, then `pageListing` would be a configuration option.
<DocLink id="kibDevTutorialAdvancedSettings" text="Advanced Settings and the uiSettings service" /> should be used if you need to add application-level configuration options. If you wanted to add a setting for listing a number of items per page in your TODO application, then `pageListing` would be a configuration option.

**Github labels**: `Team:Core`, `Feature:uiSettings`, `Feature:Advanced Settings`

Expand Down
48 changes: 48 additions & 0 deletions dev_docs/tutorials/ci.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
id: kibDevTutorialCI
slug: /kibana-dev-docs/tutorials/ci
title: CI
summary: CI
date: 2022-02-03
tags: ['kibana', 'onboarding', 'dev', 'ci']
---

## CI

Kibana uses BuildKite to run a series of checks against each pull requests and tracked branch. Results are posted in pull requests as comments and from the BuildKite UI

### Comments

Comments in pull requests can be used to trigger CI operations.

#### `buildkite test this`

Run test suites and checks.

#### `@elasticmachine merge upstream`

Merge in the most recent changes from upstream.

#### `@elasticmachine run elasticsearch-ci/docs`

Build documentation from the root `docs` folder.

### Labels

Labels can be added to a pull request to run conditional pipelines.

#### `ci:deploy-cloud`

Deploy a pull request to Elastic Cloud. Deployment information will be available as an annotation at the top of a build. Access credentials will be available in vault.

#### `ci:build-all-platforms`

Build Windows, macOS, and Linux archives. Artifacts will be available on the "Artifacts" tab of the "Build Kibana Distribution and Plugins" step.

#### `ci:build-os-packages`

Build Docker images, and Debian and RPM packages. Artifacts will be available on the "Artifacts" tab of the "Build Kibana Distribution and Plugins" step.

#### `ci:all-cypress-suites`

By default, Cypress test suites are only run when code changes are made in certain files, typically files with overlapping test coverage. Adding this label will cause all Cypress tests to run.
2 changes: 0 additions & 2 deletions docs/apm/correlations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ filtered out, you can begin viewing sample traces to continue your investigation
[[correlations-error-rate]]
==== Find failed transaction correlations

beta::[]

The correlations on the *Failed transaction correlations* tab help you discover
which attributes are most influential in distinguishing between transaction
failures and successes. In this context, the success or failure of a transaction
Expand Down
Binary file modified docs/apm/images/correlations-failed-transactions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions nav-kibana-dev.docnav.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"id": "kibDevTutorialBuildingDistributable",
"label": "Building a Kibana distributable"
},
{ "id": "kibDevTutorialCI" },
{ "id": "kibDevTutorialServerEndpoint" },
{ "id": "kibDevTutorialAdvancedSettings"}
]
Expand Down
7 changes: 0 additions & 7 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8987,13 +8987,6 @@ const BootstrapCommand = {
}, {
prefix: '[vscode]',
debug: false
});
await Object(_utils_child_process__WEBPACK_IMPORTED_MODULE_3__["spawnStreaming"])(process.execPath, ['scripts/build_ts_refs', '--ignore-type-failures'], {
cwd: kbn.getAbsolute(),
env: process.env
}, {
prefix: '[ts refs]',
debug: false
}); // send timings

await reporter.timings({
Expand Down
10 changes: 0 additions & 10 deletions packages/kbn-pm/src/commands/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,6 @@ export const BootstrapCommand: ICommand = {
{ prefix: '[vscode]', debug: false }
);

await spawnStreaming(
process.execPath,
['scripts/build_ts_refs', '--ignore-type-failures'],
{
cwd: kbn.getAbsolute(),
env: process.env,
},
{ prefix: '[ts refs]', debug: false }
);

// send timings
await reporter.timings({
upstreamBranch: kbn.kibanaProject.json.branch,
Expand Down
45 changes: 32 additions & 13 deletions src/plugins/vis_types/vega/public/components/vega_vis_component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Side Public License, v 1.
*/

import React, { useEffect, useCallback, useRef } from 'react';
import { EuiResizeObserver } from '@elastic/eui';
import React, { useEffect, useRef, useMemo, useCallback } from 'react';
import { EuiResizeObserver, EuiResizeObserverProps } from '@elastic/eui';
import { throttle } from 'lodash';

import type { IInterpreterRenderHandlers, RenderMode } from 'src/plugins/expressions';
Expand All @@ -27,6 +27,8 @@ interface VegaVisComponentProps {

type VegaVisController = InstanceType<ReturnType<typeof createVegaVisualization>>;

const THROTTLE_INTERVAL = 300;

export const VegaVisComponent = ({
visData,
fireEvent,
Expand All @@ -35,38 +37,55 @@ export const VegaVisComponent = ({
renderMode,
}: VegaVisComponentProps) => {
const chartDiv = useRef<HTMLDivElement>(null);
const renderCompleted = useRef(false);
const visController = useRef<VegaVisController | null>(null);

useEffect(() => {
if (chartDiv.current) {
const VegaVis = createVegaVisualization(deps, renderMode);
visController.current = new VegaVis(chartDiv.current, fireEvent);
}

return () => {
visController.current?.destroy();
visController.current = null;
};
}, [deps, fireEvent, renderMode]);

useEffect(() => {
const asyncRender = async (visCtrl: VegaVisController) => {
await visCtrl.render(visData);
renderCompleted.current = true;
renderComplete();
};

if (visController.current) {
visController.current.render(visData).then(renderComplete);
asyncRender(visController.current);
}
}, [visData, renderComplete]);
}, [renderComplete, visData]);

const resizeChart = useMemo(
() =>
throttle(
(dimensions) => {
visController.current?.resize(dimensions);
},
THROTTLE_INTERVAL,
{ leading: false, trailing: true }
),
[]
);

/* eslint-disable-next-line react-hooks/exhaustive-deps */
const updateChartSize = useCallback(
throttle(() => {
if (visController.current) {
visController.current.render(visData).then(renderComplete);
const onContainerResize: EuiResizeObserverProps['onResize'] = useCallback(
(dimensions) => {
if (renderCompleted.current) {
resizeChart(dimensions);
}
}, 300),
[renderComplete, visData]
},
[resizeChart]
);

return (
<EuiResizeObserver onResize={updateChartSize}>
<EuiResizeObserver onResize={onContainerResize}>
{(resizeRef) => (
<div className="vgaVis__wrapper" ref={resizeRef}>
<div ref={chartDiv} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class VegaBaseView {
_addDestroyHandler(handler: Function): void;

destroy(): Promise<void>;
resize(dimensions?: { height: number; width: number }): Promise<void>;

_$container: any;
_$controls: any;
Expand Down
15 changes: 9 additions & 6 deletions src/plugins/vis_types/vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,19 @@ export class VegaBaseView {
}
}

resize() {
async resize(dimensions) {
if (this._parser.useResize && this._view) {
this.updateVegaSize(this._view);
return this._view.runAsync();
this.updateVegaSize(this._view, dimensions);
await this._view.runAsync();

// The derived class should create this method
this.onViewContainerResize?.();
}
}

updateVegaSize(view) {
const width = Math.floor(Math.max(0, this._$container.width()));
const height = Math.floor(Math.max(0, this._$container.height()));
updateVegaSize(view, dimensions) {
const width = Math.floor(Math.max(0, dimensions?.width ?? this._$container.width()));
const height = Math.floor(Math.max(0, dimensions?.height ?? this._$container.height()));

if (view.width() !== width || view.height() !== height) {
view.width(width).height(height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ async function updateVegaView(mapBoxInstance: Map, vegaView: View) {
}

export class VegaMapView extends VegaBaseView {
private mapBoxInstance?: Map;

private get shouldShowZoomControl() {
return Boolean(this._parser.mapConfig.zoomControl);
}
Expand Down Expand Up @@ -139,6 +141,7 @@ export class VegaMapView extends VegaBaseView {
};

mapBoxInstance.once('load', initMapComponents);
this.mapBoxInstance = mapBoxInstance;
});
}

Expand Down Expand Up @@ -193,4 +196,8 @@ export class VegaMapView extends VegaBaseView {

await this.initMapContainer(vegaView);
}

protected async onViewContainerResize() {
this.mapBoxInstance?.resize();
}
}
1 change: 0 additions & 1 deletion src/plugins/vis_types/vega/public/vega_vis_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const getVegaVisRenderer: (
handlers.onDestroy(() => {
unmountComponentAtNode(domNode);
});

render(
<KibanaThemeProvider theme$={deps.core.theme.theme$}>
<VisualizationContainer handlers={handlers}>
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/vis_types/vega/public/vega_visualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { createVegaStateRestorer } from './lib/vega_state_restorer';

type VegaVisType = new (el: HTMLDivElement, fireEvent: IInterpreterRenderHandlers['event']) => {
render(visData: VegaParser): Promise<void>;
resize(dimensions?: { height: number; width: number }): Promise<void>;
destroy(): void;
};

Expand Down Expand Up @@ -97,6 +98,10 @@ export const createVegaVisualization = (
}
}

async resize(dimensions?: { height: number; width: number }) {
return this.vegaView?.resize(dimensions);
}

destroy() {
this.vegaStateRestorer.clear();
this.vegaView?.destroy();
Expand Down
8 changes: 0 additions & 8 deletions x-pack/plugins/apm/ftr_e2e/ftr_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import { FtrConfigProviderContext } from '@kbn/test';
import { CA_CERT_PATH } from '@kbn/dev-utils';

// Used to spin up a docker container with package registry service that will be used by fleet
export const packageRegistryPort = 1234;

async function config({ readConfigFile }: FtrConfigProviderContext) {
const kibanaCommonTestsConfig = await readConfigFile(
require.resolve('../../../../test/common/config.js')
Expand Down Expand Up @@ -41,11 +38,6 @@ async function config({ readConfigFile }: FtrConfigProviderContext) {
'--csp.warnLegacyBrowsers=false',
// define custom kibana server args here
`--elasticsearch.ssl.certificateAuthorities=${CA_CERT_PATH}`,

// Fleet config
`--xpack.fleet.packages.0.name=endpoint`,
`--xpack.fleet.packages.0.version=latest`,
`--xpack.fleet.registryUrl=http://localhost:${packageRegistryPort}`,
],
},
};
Expand Down
26 changes: 1 addition & 25 deletions x-pack/plugins/apm/ftr_e2e/ftr_config_run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,17 @@
* 2.0.
*/

import { defineDockerServersConfig, FtrConfigProviderContext } from '@kbn/test';
import { FtrConfigProviderContext } from '@kbn/test';
import cypress from 'cypress';
import path from 'path';
import { cypressStart } from './cypress_start';
import { packageRegistryPort } from './ftr_config';
import { FtrProviderContext } from './ftr_provider_context';

export const dockerImage =
'docker.elastic.co/package-registry/distribution@sha256:c5bf8e058727de72e561b228f4b254a14a6f880e582190d01bd5ff74318e1d0b';

async function ftrConfigRun({ readConfigFile }: FtrConfigProviderContext) {
const kibanaConfig = await readConfigFile(require.resolve('./ftr_config.ts'));

// mount the config file for the package registry
const dockerArgs: string[] = [
'-v',
`${path.join(
path.dirname(__filename),
'./apis/fixtures/package_registry_config.yml'
)}:/package-registry/config.yml`,
];

return {
...kibanaConfig.getAll(),
testRunner,
dockerServers: defineDockerServersConfig({
registry: {
enabled: true,
image: dockerImage,
portInContainer: 8080,
port: packageRegistryPort,
args: dockerArgs,
waitForLogLine: 'package manifests loaded',
},
}),
};
}

Expand Down

0 comments on commit 57ad263

Please sign in to comment.