Skip to content

Commit 26befa3

Browse files
committed
Merge remote-tracking branch 'upstream/master' into kbn-75797-so-legacy-import-indexpattern-selection
2 parents 2af8584 + 1712f0d commit 26befa3

File tree

472 files changed

+6175
-2547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+6175
-2547
lines changed

.github/ISSUE_TEMPLATE/v8_breaking_change.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: 8.0 Breaking change
33
about: Breaking changes from 7.x -> 8.0
44
title: "[Breaking change]"
5-
labels: Team:Elasticsearch UI, Feature:Upgrade Assistant
5+
labels: Team:Elasticsearch UI, Feature:Upgrade Assistant, Breaking Change
66
assignees: ''
77

88
---
@@ -11,15 +11,16 @@ assignees: ''
1111

1212
**Which release will ship the breaking change?**
1313

14-
<!-- e.g., v7.6.2 -->
14+
8.0
1515

1616
**Describe the change. How will it manifest to users?**
1717

18-
**What percentage of users will be affected?**
18+
**How many users will be affected?**
1919

20-
<!-- e.g., Roughly 75% will need to make changes to x. -->
20+
<!-- e.g., Based on telemetry data, roughly 75% of our users will need to make changes to x -->
21+
<!-- e.g., A majority of users will need to make changes to x. -->
2122

22-
**What can users to do to address the change manually?**
23+
**What can users do to address the change manually?**
2324

2425
<!-- If applicable, describe the manual workaround -->
2526

packages/kbn-apm-config-loader/src/config.test.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {
2828

2929
import { ApmConfiguration } from './config';
3030

31+
const initialEnv = { ...process.env };
32+
3133
describe('ApmConfiguration', () => {
3234
beforeEach(() => {
3335
packageMock.raw = {
@@ -39,6 +41,7 @@ describe('ApmConfiguration', () => {
3941
});
4042

4143
afterEach(() => {
44+
process.env = { ...initialEnv };
4245
resetAllMocks();
4346
});
4447

@@ -90,13 +93,16 @@ describe('ApmConfiguration', () => {
9093
let config = new ApmConfiguration(mockedRootDir, {}, false);
9194
expect(config.getConfig('serviceName')).toEqual(
9295
expect.objectContaining({
93-
serverUrl: expect.any(String),
94-
secretToken: expect.any(String),
96+
breakdownMetrics: true,
9597
})
9698
);
9799

98100
config = new ApmConfiguration(mockedRootDir, {}, true);
99-
expect(Object.keys(config.getConfig('serviceName'))).not.toContain('serverUrl');
101+
expect(config.getConfig('serviceName')).toEqual(
102+
expect.objectContaining({
103+
breakdownMetrics: false,
104+
})
105+
);
100106
});
101107

102108
it('loads the configuration from the kibana config file', () => {
@@ -156,4 +162,32 @@ describe('ApmConfiguration', () => {
156162
})
157163
);
158164
});
165+
166+
it('correctly sets environment', () => {
167+
delete process.env.ELASTIC_APM_ENVIRONMENT;
168+
delete process.env.NODE_ENV;
169+
170+
let config = new ApmConfiguration(mockedRootDir, {}, false);
171+
expect(config.getConfig('serviceName')).toEqual(
172+
expect.objectContaining({
173+
environment: 'development',
174+
})
175+
);
176+
177+
process.env.NODE_ENV = 'production';
178+
config = new ApmConfiguration(mockedRootDir, {}, false);
179+
expect(config.getConfig('serviceName')).toEqual(
180+
expect.objectContaining({
181+
environment: 'production',
182+
})
183+
);
184+
185+
process.env.ELASTIC_APM_ENVIRONMENT = 'ci';
186+
config = new ApmConfiguration(mockedRootDir, {}, false);
187+
expect(config.getConfig('serviceName')).toEqual(
188+
expect.objectContaining({
189+
environment: 'ci',
190+
})
191+
);
192+
});
159193
});

packages/kbn-apm-config-loader/src/config.ts

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,26 @@ import { readFileSync } from 'fs';
2626
import { ApmAgentConfig } from './types';
2727

2828
const getDefaultConfig = (isDistributable: boolean): ApmAgentConfig => {
29-
if (isDistributable) {
30-
return {
31-
active: false,
32-
globalLabels: {},
33-
// Do not use a centralized controlled config
34-
centralConfig: false,
35-
// Capture all exceptions that are not caught
36-
logUncaughtExceptions: true,
37-
// Can be performance intensive, disabling by default
38-
breakdownMetrics: false,
39-
};
40-
}
41-
29+
// https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html
4230
return {
43-
active: false,
44-
serverUrl: 'https://f1542b814f674090afd914960583265f.apm.us-central1.gcp.cloud.es.io:443',
31+
active: process.env.ELASTIC_APM_ACTIVE || false,
32+
environment: process.env.ELASTIC_APM_ENVIRONMENT || process.env.NODE_ENV || 'development',
33+
34+
serverUrl: 'https://b1e3b4b4233e44cdad468c127d0af8d8.apm.europe-west1.gcp.cloud.es.io:443',
35+
4536
// The secretToken below is intended to be hardcoded in this file even though
4637
// it makes it public. This is not a security/privacy issue. Normally we'd
4738
// instead disable the need for a secretToken in the APM Server config where
4839
// the data is transmitted to, but due to how it's being hosted, it's easier,
4940
// for now, to simply leave it in.
50-
secretToken: 'R0Gjg46pE9K9wGestd',
41+
secretToken: '2OyjjaI6RVkzx2O5CV',
42+
43+
logUncaughtExceptions: true,
5144
globalLabels: {},
52-
breakdownMetrics: true,
5345
centralConfig: false,
54-
logUncaughtExceptions: true,
46+
47+
// Can be performance intensive, disabling by default
48+
breakdownMetrics: isDistributable ? false : true,
5549
};
5650
};
5751

@@ -84,7 +78,8 @@ export class ApmConfiguration {
8478
getDefaultConfig(this.isDistributable),
8579
this.getConfigFromKibanaConfig(),
8680
this.getDevConfig(),
87-
this.getDistConfig()
81+
this.getDistConfig(),
82+
this.getCIConfig()
8883
);
8984

9085
const rev = this.getGitRev();
@@ -146,6 +141,21 @@ export class ApmConfiguration {
146141
};
147142
}
148143

144+
private getCIConfig(): ApmAgentConfig {
145+
if (process.env.ELASTIC_APM_ENVIRONMENT !== 'ci') {
146+
return {};
147+
}
148+
149+
return {
150+
globalLabels: {
151+
branch: process.env.ghprbSourceBranch || '',
152+
targetBranch: process.env.ghprbTargetBranch || '',
153+
ciJobName: process.env.JOB_NAME || '',
154+
ciBuildNumber: process.env.BUILD_NUMBER || '',
155+
},
156+
};
157+
}
158+
149159
private getGitRev() {
150160
if (this.isDistributable) {
151161
return this.pkgBuild.sha;

packages/kbn-optimizer/src/cli.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ run(
146146
await lastValueFrom(update$.pipe(logOptimizerState(log, config)));
147147

148148
if (updateLimits) {
149-
updateBundleLimits(log, config);
149+
updateBundleLimits({
150+
log,
151+
config,
152+
dropMissing: !(focus || filter),
153+
});
150154
}
151155
},
152156
{

packages/kbn-optimizer/src/limits.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,18 @@ export function validateLimitsForAllBundles(log: ToolingLog, config: OptimizerCo
7979
log.success('limits.yml file valid');
8080
}
8181

82-
export function updateBundleLimits(log: ToolingLog, config: OptimizerConfig) {
82+
interface UpdateBundleLimitsOptions {
83+
log: ToolingLog;
84+
config: OptimizerConfig;
85+
dropMissing: boolean;
86+
}
87+
88+
export function updateBundleLimits({ log, config, dropMissing }: UpdateBundleLimitsOptions) {
8389
const metrics = getMetrics(log, config);
8490

85-
const pageLoadAssetSize: NonNullable<Limits['pageLoadAssetSize']> = {};
91+
const pageLoadAssetSize: NonNullable<Limits['pageLoadAssetSize']> = dropMissing
92+
? {}
93+
: config.limits.pageLoadAssetSize ?? {};
8694

8795
for (const metric of metrics.sort((a, b) => a.id.localeCompare(b.id))) {
8896
if (metric.group === 'page load bundle size') {

src/core/server/elasticsearch/client/client_config.test.ts

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -216,28 +216,14 @@ describe('parseClientOptions', () => {
216216
);
217217
});
218218

219-
it('adds auth to the nodes if both `username` and `password` are set', () => {
220-
let options = parseClientOptions(
219+
it('does not add auth to the nodes', () => {
220+
const options = parseClientOptions(
221221
createConfig({
222222
username: 'user',
223-
hosts: ['http://node-A:9200'],
224-
}),
225-
false
226-
);
227-
expect(options.nodes).toMatchInlineSnapshot(`
228-
Array [
229-
Object {
230-
"url": "http://node-a:9200/",
231-
},
232-
]
233-
`);
234-
235-
options = parseClientOptions(
236-
createConfig({
237223
password: 'pass',
238224
hosts: ['http://node-A:9200'],
239225
}),
240-
false
226+
true
241227
);
242228
expect(options.nodes).toMatchInlineSnapshot(`
243229
Array [
@@ -246,22 +232,6 @@ describe('parseClientOptions', () => {
246232
},
247233
]
248234
`);
249-
250-
options = parseClientOptions(
251-
createConfig({
252-
username: 'user',
253-
password: 'pass',
254-
hosts: ['http://node-A:9200'],
255-
}),
256-
false
257-
);
258-
expect(options.nodes).toMatchInlineSnapshot(`
259-
Array [
260-
Object {
261-
"url": "http://user:pass@node-a:9200/",
262-
},
263-
]
264-
`);
265235
});
266236
});
267237
describe('when `scoped` is true', () => {

src/core/server/elasticsearch/client/client_config.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function parseClientOptions(
9393
};
9494
}
9595

96-
clientOptions.nodes = config.hosts.map((host) => convertHost(host, !scoped, config));
96+
clientOptions.nodes = config.hosts.map((host) => convertHost(host));
9797

9898
if (config.ssl) {
9999
clientOptions.ssl = generateSslConfig(
@@ -140,18 +140,10 @@ const generateSslConfig = (
140140
return ssl;
141141
};
142142

143-
const convertHost = (
144-
host: string,
145-
needAuth: boolean,
146-
{ username, password }: ElasticsearchClientConfig
147-
): NodeOptions => {
143+
const convertHost = (host: string): NodeOptions => {
148144
const url = new URL(host);
149145
const isHTTPS = url.protocol === 'https:';
150146
url.port = url.port || (isHTTPS ? '443' : '80');
151-
if (needAuth && username && password) {
152-
url.username = username;
153-
url.password = password;
154-
}
155147

156148
return {
157149
url,

src/dev/ci_setup/setup_env.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export NODE_OPTIONS="$NODE_OPTIONS --max-old-space-size=4096"
2424
###
2525
export FORCE_COLOR=1
2626

27+
### APM tracking
28+
###
29+
export ELASTIC_APM_ENVIRONMENT=ci
30+
2731
###
2832
### check that we seem to be in a kibana project
2933
###

src/plugins/home/public/application/components/solutions_section/solutions_section.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import { SolutionPanel } from './solution_panel';
2525
import { FeatureCatalogueEntry, FeatureCatalogueSolution } from '../../../';
2626

2727
const sortByOrder = (
28-
{ order: orderA = 0 }: FeatureCatalogueSolution,
29-
{ order: orderB = 0 }: FeatureCatalogueSolution
28+
{ order: orderA = 0 }: FeatureCatalogueSolution | FeatureCatalogueEntry,
29+
{ order: orderB = 0 }: FeatureCatalogueSolution | FeatureCatalogueEntry
3030
) => orderA - orderB;
3131

3232
interface Props {
@@ -38,7 +38,9 @@ interface Props {
3838
export const SolutionsSection: FC<Props> = ({ addBasePath, solutions, directories }) => {
3939
// Separate Kibana from other solutions
4040
const kibana = solutions.find(({ id }) => id === 'kibana');
41-
const kibanaApps = directories.filter(({ solutionId }) => solutionId === 'kibana');
41+
const kibanaApps = directories
42+
.filter(({ solutionId }) => solutionId === 'kibana')
43+
.sort(sortByOrder);
4244
solutions = solutions.sort(sortByOrder).filter(({ id }) => id !== 'kibana');
4345

4446
return (

src/plugins/kibana_overview/public/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class KibanaOverviewPlugin
109109
defaultMessage: 'Search and find insights.',
110110
}),
111111
i18n.translate('kibanaOverview.kibana.appDescription3', {
112-
defaultMessage: 'Design pixel-perfect reports.',
112+
defaultMessage: 'Design pixel-perfect presentations.',
113113
}),
114114
i18n.translate('kibanaOverview.kibana.appDescription4', {
115115
defaultMessage: 'Plot geographic data.',

0 commit comments

Comments
 (0)