Skip to content

Commit

Permalink
Merge branch 'main' into issue-xxx-upgrade-markdown-it
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Feb 16, 2022
2 parents a606470 + cf25ac3 commit 22b06b5
Show file tree
Hide file tree
Showing 328 changed files with 15,342 additions and 2,760 deletions.
11 changes: 11 additions & 0 deletions .buildkite/pipelines/docker_context.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
steps:
- command: .buildkite/scripts/steps/docker_context/build.sh
label: 'Docker Build Context'
agents:
queue: n2-4
timeout_in_minutes: 30
key: build-docker-context
retry:
automatic:
- exit_status: '*'
limit: 1
1 change: 1 addition & 0 deletions .buildkite/pipelines/es_snapshots/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ steps:

- command: .buildkite/scripts/steps/test/jest_integration.sh
label: 'Jest Integration Tests'
parallelism: 2
agents:
queue: n2-4
timeout_in_minutes: 120
Expand Down
19 changes: 12 additions & 7 deletions .buildkite/scripts/steps/cloud/build_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ node scripts/build \
CLOUD_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" docker.elastic.co/kibana-ci/kibana-cloud)
CLOUD_DEPLOYMENT_NAME="kibana-pr-$BUILDKITE_PULL_REQUEST"

jq '
.resources.kibana[0].plan.kibana.docker_image = "'$CLOUD_IMAGE'" |
.name = "'$CLOUD_DEPLOYMENT_NAME'" |
.resources.kibana[0].plan.kibana.version = "'$VERSION'" |
.resources.elasticsearch[0].plan.elasticsearch.version = "'$VERSION'"
' .buildkite/scripts/steps/cloud/deploy.json > /tmp/deploy.json

CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id')
JSON_FILE=$(mktemp --suffix ".json")
if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
jq '
.resources.kibana[0].plan.kibana.docker_image = "'$CLOUD_IMAGE'" |
.name = "'$CLOUD_DEPLOYMENT_NAME'" |
.resources.kibana[0].plan.kibana.version = "'$VERSION'" |
.resources.elasticsearch[0].plan.elasticsearch.version = "'$VERSION'"
' .buildkite/scripts/steps/cloud/deploy.json > /tmp/deploy.json

ecctl deployment create --track --output json --file /tmp/deploy.json &> "$JSON_FILE"
CLOUD_DEPLOYMENT_USERNAME=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.username' "$JSON_FILE")
CLOUD_DEPLOYMENT_PASSWORD=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.password' "$JSON_FILE")
Expand All @@ -59,6 +59,11 @@ if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then

retry 5 5 vault write "secret/kibana-issues/dev/cloud-deploy/$CLOUD_DEPLOYMENT_NAME" username="$CLOUD_DEPLOYMENT_USERNAME" password="$CLOUD_DEPLOYMENT_PASSWORD"
else
ecctl deployment show "$CLOUD_DEPLOYMENT_ID" --generate-update-payload | jq '
.resources.kibana[0].plan.kibana.docker_image = "'$CLOUD_IMAGE'" |
.resources.kibana[0].plan.kibana.version = "'$VERSION'" |
.resources.elasticsearch[0].plan.elasticsearch.version = "'$VERSION'"
' > /tmp/deploy.json
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/deploy.json &> "$JSON_FILE"
fi

Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/steps/code_coverage/jest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ is_test_execution_step

echo '--- Jest code coverage'

.buildkite/scripts/steps/code_coverage/jest_parallel.sh
.buildkite/scripts/steps/code_coverage/jest_parallel.sh jest.config.js

tar -czf kibana-jest-thread-coverage.tar.gz target/kibana-coverage/jest

echo "--- Merging code coverage for a thread"
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js --reporter json
rm -rf target/kibana-coverage/jest/*
mv target/kibana-coverage/jest-combined/coverage-final.json "target/kibana-coverage/jest/jest-merged-coverage-$(date +%s%3N).json"
mv target/kibana-coverage/jest-combined/coverage-final.json "target/kibana-coverage/jest/jest-merged-coverage-$(date +%s%3N).json"
16 changes: 16 additions & 0 deletions .buildkite/scripts/steps/docker_context/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euo pipefail

.buildkite/scripts/bootstrap.sh

echo "--- Create Kibana Docker contexts"
mkdir -p target
node scripts/build --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives

echo "--- Build default context"
DOCKER_BUILD_FOLDER=$(mktemp -d)

tar -xf target/kibana-[0-9]*-docker-build-context.tar.gz -C "$DOCKER_BUILD_FOLDER"
cd $DOCKER_BUILD_FOLDER
docker build .
3 changes: 1 addition & 2 deletions .buildkite/scripts/steps/storybooks/build_and_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const STORYBOOKS = [
'canvas',
'ci_composite',
'cloud',
'codeeditor',
'custom_integrations',
'dashboard_enhanced',
'dashboard',
Expand All @@ -31,13 +30,13 @@ const STORYBOOKS = [
'expression_tagcloud',
'fleet',
'infra',
'kibana_react',
'lists',
'observability',
'presentation',
'security_solution',
'shared_ux',
'ui_actions_enhanced',
'url_template_editor',
];

const GITHUB_CONTEXT = 'Build and Publish Storybooks';
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/test/jest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ is_test_execution_step

echo '--- Jest'
checks-reporter-with-killswitch "Jest Unit Tests $((BUILDKITE_PARALLEL_JOB+1))" \
.buildkite/scripts/steps/test/jest_parallel.sh
.buildkite/scripts/steps/test/jest_parallel.sh jest.config.js
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/test/jest_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ while read -r config; do

((i=i+1))
# uses heredoc to avoid the while loop being in a sub-shell thus unable to overwrite exitCode
done <<< "$(find src x-pack packages -name ${1:-jest.config.js} -not -path "*/__fixtures__/*" | sort)"
done <<< "$(find src x-pack packages -name "$1" -not -path "*/__fixtures__/*" | sort)"

exit $exitCode
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export declare type KibanaExecutionContext = {
readonly type: string;
readonly name: string;
readonly id: string;
readonly description: string;
readonly description?: string;
readonly url?: string;
parent?: KibanaExecutionContext;
child?: KibanaExecutionContext;
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export declare type KibanaExecutionContext = {
readonly type: string;
readonly name: string;
readonly id: string;
readonly description: string;
readonly description?: string;
readonly url?: string;
parent?: KibanaExecutionContext;
child?: KibanaExecutionContext;
};
```
5 changes: 2 additions & 3 deletions docs/user/ml/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ If {stack-security-features} are enabled, users must have the necessary
privileges to use {ml-features}. Refer to
{ml-docs}/setup.html#setup-privileges[Set up {ml-features}].

NOTE: There are limitations in {ml-features} that affect {kib}. For more information, refer to {ml-docs}/ml-limitations.html[Machine learning].
NOTE: There are limitations in {ml-features} that affect {kib}. For more
information, refer to {ml-docs}/ml-limitations.html[{ml-cap}].

--

Expand Down Expand Up @@ -84,8 +85,6 @@ and {ml-docs}/ml-ad-overview.html[{ml-cap} {anomaly-detect}].
[[xpack-ml-dfanalytics]]
== {dfanalytics-cap}

experimental[]

The Elastic {ml} {dfanalytics} feature enables you to analyze your data using
{classification}, {oldetection}, and {regression} algorithms and generate new
indices that contain the results alongside your source data.
Expand Down
20 changes: 10 additions & 10 deletions docs/user/troubleshooting/trace-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ Now, you can see the request to {es} has been initiated by the `[Logs] Unique Vi
[source,text]
----
[DEBUG][execution_context] stored the execution context: {
"parent": {
"type": "application",
"name": "dashboard",
"id": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b",
"description": "[Logs] Web Traffic","url":"/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b"
"type": "application",
"name": "dashboard",
"id": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b",
"description": "[Logs] Web Traffic","url":"/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b"
"child": {
"type": "visualization",
"name": "Vega",
"id": "cb099a20-ea66-11eb-9425-113343a037e3",
"description": "[Logs] Unique Visitor Heatmap",
"url": "/app/visualize#/edit/cb099a20-ea66-11eb-9425-113343a037e3"
},
"type": "visualization",
"name": "Vega",
"id": "cb099a20-ea66-11eb-9425-113343a037e3",
"description": "[Logs] Unique Visitor Heatmap",
"url": "/app/visualize#/edit/cb099a20-ea66-11eb-9425-113343a037e3"
}
----
27 changes: 0 additions & 27 deletions jest.config.integration.js

This file was deleted.

24 changes: 0 additions & 24 deletions jest.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion nav-kibana-dev.docnav.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"id": "kibDevTutorialBuildingDistributable",
"label": "Building a Kibana distributable"
},
{ "id": "kibDevTutorialServerEndpoint" }
{ "id": "kibDevTutorialServerEndpoint" },
{ "id": "kibDevTutorialAdvancedSettings"}
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
"brace": "0.11.1",
"broadcast-channel": "^4.9.0",
"broadcast-channel": "^4.10.0",
"canvg": "^3.0.9",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
Expand Down
10 changes: 7 additions & 3 deletions packages/kbn-analytics/src/metrics/ui_counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@

import { METRIC_TYPE } from './';

export type UiCounterMetricType = METRIC_TYPE.CLICK | METRIC_TYPE.LOADED | METRIC_TYPE.COUNT;
export type UiCounterMetricType =
| METRIC_TYPE.CLICK
| METRIC_TYPE.LOADED
| METRIC_TYPE.COUNT
| string;
export interface UiCounterMetricConfig {
type: UiCounterMetricType;
type: string;
appName: string;
eventName: string;
count?: number;
}

export interface UiCounterMetric {
type: UiCounterMetricType;
type: string;
appName: string;
eventName: string;
count: number;
Expand Down
52 changes: 23 additions & 29 deletions packages/kbn-analytics/src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
*/

import moment from 'moment-timezone';
import { UnreachableCaseError, wrapArray } from './util';
import { wrapArray } from './util';
import { ApplicationUsageTracker } from './application_usage_tracker';
import { Metric, UiCounterMetricType, METRIC_TYPE } from './metrics';
import { Metric, METRIC_TYPE } from './metrics';
const REPORT_VERSION = 3;

import type { UiCounterMetric, UiCounterMetricType } from './metrics/ui_counter';
import type { UserAgentMetric } from './metrics/user_agent';
import type { ApplicationUsageMetric } from './metrics/application_usage';

export interface Report {
reportVersion: typeof REPORT_VERSION;
uiCounter?: Record<
Expand Down Expand Up @@ -77,55 +81,35 @@ export class ReportManager {
const { appName, type } = metric;
return `${appName}-${type}`;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, eventName, type } = metric;
return `${appName}-${type}-${eventName}`;
}
case METRIC_TYPE.APPLICATION_USAGE: {
const { appId, viewId } = metric;
const { appId, viewId } = metric as ApplicationUsageMetric;
return ApplicationUsageTracker.serializeKey({ appId, viewId });
}
default:
throw new UnreachableCaseError(metric);
const { appName, eventName, type } = metric as UiCounterMetric;
return `${appName}-${type}-${eventName}`;
}
}
private assignReport(report: Report, metric: Metric) {
const key = ReportManager.createMetricKey(metric);
switch (metric.type) {
case METRIC_TYPE.USER_AGENT: {
const { appName, type, userAgent } = metric;
const { appName, type, userAgent } = metric as UserAgentMetric;
if (userAgent) {
report.userAgent = {
[key]: {
key,
appName,
type,
userAgent: metric.userAgent,
userAgent,
},
};
}

return;
}
case METRIC_TYPE.CLICK:
case METRIC_TYPE.LOADED:
case METRIC_TYPE.COUNT: {
const { appName, type, eventName, count } = metric;
report.uiCounter = report.uiCounter || {};
const currentTotal = report.uiCounter[key]?.total;
report.uiCounter[key] = {
key,
appName,
eventName,
type,
total: this.incrementTotal(count, currentTotal),
};
return;
}
case METRIC_TYPE.APPLICATION_USAGE: {
const { numberOfClicks, startTime, appId, viewId } = metric;
const { numberOfClicks, startTime, appId, viewId } = metric as ApplicationUsageMetric;
const minutesOnScreen = moment().diff(startTime, 'minutes', true);

report.application_usage = report.application_usage || {};
Expand All @@ -144,7 +128,17 @@ export class ReportManager {
return;
}
default:
throw new UnreachableCaseError(metric);
const { appName, type, eventName, count } = metric as UiCounterMetric;
report.uiCounter = report.uiCounter || {};
const currentTotal = report.uiCounter[key]?.total;
report.uiCounter[key] = {
key,
appName,
eventName,
type,
total: this.incrementTotal(count, currentTotal),
};
return;
}
}
}
Loading

0 comments on commit 22b06b5

Please sign in to comment.