Skip to content

Commit

Permalink
Merge branch 'master' into reporting/fix-deprecation-test
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 2, 2021
2 parents 3bd4ca3 + 1205ba4 commit edcac18
Show file tree
Hide file tree
Showing 260 changed files with 6,736 additions and 1,321 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
source .buildkite/scripts/common/util.sh

echo "--- yarn install and bootstrap"
yarn kbn bootstrap --verbose
yarn kbn bootstrap

###
### upload ts-refs-cache artifacts as quickly as possible so they are available for download
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/scripts/build_kibana_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ node scripts/build_kibana_platform_plugins \
--scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \
--scan-dir "$XPACK_DIR/test/usage_collection/plugins" \
--scan-dir "$XPACK_DIR/test/security_functional/fixtures/common" \
--scan-dir "$XPACK_DIR/examples" \
--verbose
--scan-dir "$XPACK_DIR/examples"

echo "--- Archive built plugins"
shopt -s globstar
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/lifecycle/build_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const { BuildkiteClient } = require('kibana-buildkite-library');
console.log(status.success ? 'true' : 'false');
process.exit(0);
} catch (ex) {
console.error('Buildkite API Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Body', ex.response.data);
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
console.error(ex);
process.exit(1);
}
})();
6 changes: 5 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const { CiStats } = require('kibana-buildkite-library');
try {
await CiStats.onComplete();
} catch (ex) {
console.error(ex);
console.error('CI Stats Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
6 changes: 5 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const { CiStats } = require('kibana-buildkite-library');
try {
await CiStats.onStart();
} catch (ex) {
console.error(ex);
console.error('CI Stats Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1656,5 +1656,24 @@ module.exports = {
'@typescript-eslint/prefer-ts-expect-error': 'error',
},
},

/**
* Disallow `export *` syntax in plugin/core public/server/common index files and instead
* require that plugins/core explicitly export the APIs that should be accessible outside the plugin.
*
* To add your plugin to this list just update the relevant glob with the name of your plugin
*/
{
files: [
'src/core/{server,public,common}/index.ts',
'src/plugins/*/{server,public,common}/index.ts',
'src/plugins/*/*/{server,public,common}/index.ts',
'x-pack/plugins/*/{server,public,common}/index.ts',
'x-pack/plugins/*/*/{server,public,common}/index.ts',
],
rules: {
'@kbn/eslint/no_export_all': 'error',
},
},
],
};
26 changes: 26 additions & 0 deletions .github/workflows/sync-main-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Synchronize all pushes to 'master' branch with 'main' branch to facilitate migration
name: "Sync main branch"
on:
push:
branches:
- master

jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from master branch

steps:
- name: Checkout target repo
uses: actions/checkout@v2
with:
ref: main

- name: Sync upstream changes
id: sync
uses: aormsby/[email protected]
with:
target_sync_branch: main
target_repo_token: ${{ secrets.KIBANAMACHINE_TOKEN }}
upstream_sync_branch: master
upstream_sync_repo: elastic/kibana
25 changes: 12 additions & 13 deletions docs/apm/correlations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,33 @@ piece of hardware, like a host or pod. Or, perhaps a set of users, based on IP
address or region, is facing increased latency due to local data center issues.

To find correlations, select a service on the *Services* page in the {apm-app}
and click **View correlations**.
then select a transaction group from the *Transactions* tab.

NOTE: Queries within the {apm-app} are also applied to the correlations.

[discrete]
[[correlations-latency]]
==== Find high transaction latency correlations

The correlations on the *Latency* tab help you discover which attributes are
contributing to increased transaction latency.
The correlations on the *Latency correlations* tab help you discover which
attributes are contributing to increased transaction latency.

[role="screenshot"]
image::apm/images/correlations-hover.png[Latency correlations]

The progress bar indicates the status of the asynchronous analysis, which
performs statistical searches across a large number of attributes. For large
time ranges and services with high transaction throughput this might take some
time. To improve performance, reduce the time range on the service overview
page.
time ranges and services with high transaction throughput, this might take some
time. To improve performance, reduce the time range.

The latency distribution chart visualizes the overall latency of the
transactions in the service. If there are attributes that have a statistically
significant correlation with slow response times, they are listed in a table
below the chart. The table is sorted by correlation coefficients that range from
0 to 1. Attributes with higher correlation values are more likely to contribute
to high latency transactions. By default, the attribute with the highest
correlation value is added to the chart. To see the latency distribution for
other attributes, hover over their row in the table.
transactions in the transaction group. If there are attributes that have a
statistically significant correlation with slow response times, they are listed
in a table below the chart. The table is sorted by correlation coefficients that
range from 0 to 1. Attributes with higher correlation values are more likely to
contribute to high latency transactions. By default, the attribute with the
highest correlation value is added to the chart. To see the latency distribution
for other attributes, hover over their row in the table.

If a correlated attribute seems noteworthy, use the **Filter** quick links:

Expand Down
Binary file modified docs/apm/images/correlations-hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
```typescript
readonly links: {
readonly settings: string;
readonly apm: {
readonly kibanaSettings: string;
readonly supportedServiceMaps: string;
};
readonly canvas: {
readonly guide: string;
};
Expand Down
2 changes: 1 addition & 1 deletion docs/settings/reporting-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ With Security enabled, Reporting has two forms of access control: each user can

[NOTE]
============================================================================
The `xpack.reporting.roles` settings are for a deprecated system of access control in Reporting. It does not allow API Keys to generate reports, and it doesn't allow {kib} application privileges. We recommend you explicitly turn off reporting's deprecated access control feature by adding `xpack.reporting.roles.enabled: false` in kibana.yml. This will enable application privileges for reporting, as described in <<grant-user-access, granting users access to reporting>>.
The `xpack.reporting.roles` settings are for a deprecated system of access control in Reporting. It does not allow API Keys to generate reports, and it doesn't allow {kib} application privileges. We recommend you explicitly turn off reporting's deprecated access control feature by adding `xpack.reporting.roles.enabled: false` in kibana.yml. This will enable you to create custom roles that provide application privileges for reporting, as described in <<grant-user-access, granting users access to reporting>>.
============================================================================

[[xpack-reporting-roles-enabled]] `xpack.reporting.roles.enabled`::
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.19",
"@elastic/ems-client": "7.15.0",
"@elastic/eui": "37.3.0",
"@elastic/eui": "37.3.1",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "^9.0.1-kibana3",
"@elastic/maki": "6.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ export class CiStatsReporter {
? `${error.response.status} response`
: 'no response';

const seconds = attempt * 10;
this.log.warning(
`failed to reach ci-stats service [reason=${reason}], retrying in ${attempt} seconds`
`failed to reach ci-stats service, retrying in ${seconds} seconds, [reason=${reason}], [error=${error.message}]`
);

await new Promise((resolve) => setTimeout(resolve, attempt * 1000));
await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-eslint-plugin-eslint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PKG_REQUIRE_NAME = "@kbn/eslint-plugin-eslint"
SOURCE_FILES = glob(
[
"rules/**/*.js",
"helpers/**/*.js",
"index.js",
"lib.js",
],
Expand Down
11 changes: 11 additions & 0 deletions packages/kbn-eslint-plugin-eslint/__fixtures__/bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable no-restricted-syntax */

export class Bar {}
13 changes: 13 additions & 0 deletions packages/kbn-eslint-plugin-eslint/__fixtures__/baz.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable no-restricted-syntax */

export const one = 1;
export const two = 2;
export const three = 3;
31 changes: 31 additions & 0 deletions packages/kbn-eslint-plugin-eslint/__fixtures__/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable no-restricted-syntax */

export type { Bar as ReexportedClass } from './bar';

export const someConst = 'bar';

// eslint-disable-next-line prefer-const
export let someLet = 'bar';

export function someFunction() {}

export class SomeClass {}

export interface SomeInterface {
prop: number;
}

export enum SomeEnum {
a = 'a',
b = 'b',
}

export type TypeAlias = string[];
11 changes: 11 additions & 0 deletions packages/kbn-eslint-plugin-eslint/__fixtures__/top.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable no-restricted-syntax */

export * from './foo';
82 changes: 82 additions & 0 deletions packages/kbn-eslint-plugin-eslint/helpers/codegen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

const t = require('@babel/types');
const { default: generate } = require('@babel/generator');

/** @typedef {import('./export_set').ExportSet} ExportSet */

/**
* Generate code for replacing a `export * from './path'`, ie.
*
* export type { foo } from './path'
* export { bar } from './path'
* @param {ExportSet} exportSet
* @param {string} source
*/
const getExportCode = (exportSet, source) => {
const exportedTypes = exportSet.types.size
? t.exportNamedDeclaration(
undefined,
Array.from(exportSet.types).map((n) => t.exportSpecifier(t.identifier(n), t.identifier(n))),
t.stringLiteral(source)
)
: undefined;

if (exportedTypes) {
exportedTypes.exportKind = 'type';
}

const exportedValues = exportSet.values.size
? t.exportNamedDeclaration(
undefined,
Array.from(exportSet.values).map((n) =>
t.exportSpecifier(t.identifier(n), t.identifier(n))
),
t.stringLiteral(source)
)
: undefined;

return generate(t.program([exportedTypes, exportedValues].filter(Boolean))).code;
};

/**
* Generate code for replacing a `export * as name from './path'`, ie.
*
* import { foo, bar } from './path'
* export const name = { foo, bar }
*
* @param {string} nsName
* @param {string[]} exportNames
* @param {string} source
*/
const getExportNamedNamespaceCode = (nsName, exportNames, source) => {
return generate(
t.program([
t.importDeclaration(
exportNames.map((n) => t.importSpecifier(t.identifier(n), t.identifier(n))),
t.stringLiteral(source)
),
t.exportNamedDeclaration(
t.variableDeclaration('const', [
t.variableDeclarator(
t.identifier(nsName),
t.objectExpression(
exportNames.map((n) =>
t.objectProperty(t.identifier(n), t.identifier(n), false, true)
)
)
),
])
),
])
).code;
};

module.exports = { getExportCode, getExportNamedNamespaceCode };
34 changes: 34 additions & 0 deletions packages/kbn-eslint-plugin-eslint/helpers/export_set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/**
* Helper class to collect exports of different types, either "value" exports or "type" exports
*/
class ExportSet {
constructor() {
/** @type {Set<string>} */
this.values = new Set();

/** @type {Set<string>} */
this.types = new Set();
}

get size() {
return this.values.size + this.types.size;
}

/**
* @param {'value'|'type'} type
* @param {string} value
*/
add(type, value) {
this[type + 's'].add(value);
}
}

module.exports = { ExportSet };
Loading

0 comments on commit edcac18

Please sign in to comment.