Skip to content

Commit 7a44e8b

Browse files
Merge branch '8.19' into eui/104.0.0-amsterdam.1
2 parents 70a3e96 + 2204875 commit 7a44e8b

46 files changed

Lines changed: 1246 additions & 194 deletions

File tree

Some content is hidden

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

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,7 @@ module.exports = {
23832383
],
23842384
rules: {
23852385
'@kbn/eslint/scout_no_describe_configure': 'error',
2386+
'@kbn/eslint/scout_max_one_describe': 'error',
23862387
'@kbn/eslint/scout_test_file_naming': 'error',
23872388
'@kbn/eslint/scout_require_api_client_in_api_test': 'error',
23882389
'@kbn/eslint/scout_no_es_archiver_in_parallel_tests': 'error',

fleet_packages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
{
3232
"name": "elastic_agent",
33-
"version": "2.6.10"
33+
"version": "2.6.11"
3434
},
3535
{
3636
"name": "endpoint",

packages/kbn-eslint-plugin-eslint/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = {
2020
no_this_in_property_initializers: require('./rules/no_this_in_property_initializers'),
2121
no_unsafe_console: require('./rules/no_unsafe_console'),
2222
scout_no_describe_configure: require('./rules/scout_no_describe_configure'),
23+
scout_max_one_describe: require('./rules/scout_max_one_describe'),
2324
scout_test_file_naming: require('./rules/scout_test_file_naming'),
2425
scout_require_api_client_in_api_test: require('./rules/scout_require_api_client_in_api_test'),
2526
scout_no_es_archiver_in_parallel_tests: require('./rules/scout_no_es_archiver_in_parallel_tests'),
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
/** @typedef {import("eslint").Rule.RuleModule} Rule */
11+
/** @typedef {import("@typescript-eslint/typescript-estree").TSESTree.CallExpression} CallExpression */
12+
13+
const ERROR_MSG =
14+
'Only one root-level describe block is allowed per file. This is required for auto-skip functionality in CI.';
15+
16+
/**
17+
* Checks if a node represents a method describe() call (e.g., test.describe, apiTest.describe)
18+
* @param {CallExpression} node
19+
* @returns {boolean} True if this is a method describe call
20+
*/
21+
const isDescribeCall = (node) => {
22+
// Check for *.describe() pattern
23+
if (
24+
node.callee.type === 'MemberExpression' &&
25+
node.callee.property.type === 'Identifier' &&
26+
node.callee.property.name === 'describe'
27+
) {
28+
return true;
29+
}
30+
31+
return false;
32+
};
33+
34+
/** @type {Rule} */
35+
module.exports = {
36+
meta: {
37+
type: 'problem',
38+
docs: {
39+
description: 'Ensure at most one root-level describe block in Scout tests',
40+
category: 'Best Practices',
41+
},
42+
fixable: null,
43+
schema: [],
44+
},
45+
create: (context) => {
46+
let rootDescribeCount = 0;
47+
let depth = 0;
48+
49+
return {
50+
CallExpression(node) {
51+
if (isDescribeCall(node)) {
52+
// Only count root-level describe calls (depth === 0)
53+
if (depth === 0) {
54+
rootDescribeCount++;
55+
// Report error if this is the second or subsequent occurrence
56+
if (rootDescribeCount > 1) {
57+
context.report({
58+
node,
59+
message: ERROR_MSG,
60+
});
61+
}
62+
}
63+
depth++;
64+
}
65+
},
66+
'CallExpression:exit'(node) {
67+
if (isDescribeCall(node)) {
68+
depth--;
69+
}
70+
},
71+
};
72+
},
73+
};
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
const { RuleTester } = require('eslint');
11+
const rule = require('./scout_max_one_describe');
12+
const dedent = require('dedent');
13+
14+
const ERROR_MSG =
15+
'Only one root-level describe block is allowed per file. This is required for auto-skip functionality in CI.';
16+
17+
const ruleTester = new RuleTester({
18+
parser: require.resolve('@typescript-eslint/parser'),
19+
parserOptions: {
20+
sourceType: 'module',
21+
ecmaVersion: 2018,
22+
ecmaFeatures: {
23+
jsx: true,
24+
},
25+
},
26+
});
27+
28+
ruleTester.run('@kbn/eslint/scout_max_one_describe', rule, {
29+
valid: [
30+
// No describe blocks at all
31+
{
32+
code: dedent`
33+
test('should work', () => {
34+
expect(true).toBe(true);
35+
});
36+
`,
37+
},
38+
// Single apiTest.describe()
39+
{
40+
code: dedent`
41+
apiTest.describe('my API test suite', () => {
42+
apiTest('should work', () => {
43+
expect(true).toBe(true);
44+
});
45+
});
46+
`,
47+
},
48+
// Single test.describe()
49+
{
50+
code: dedent`
51+
test.describe('my test suite', () => {
52+
test('should work', () => {
53+
expect(true).toBe(true);
54+
});
55+
});
56+
`,
57+
},
58+
// Single spaceTest.describe()
59+
{
60+
code: dedent`
61+
spaceTest.describe('my space-aware test suite', () => {
62+
spaceTest('should work', () => {
63+
expect(true).toBe(true);
64+
});
65+
});
66+
`,
67+
},
68+
// Two bare describe() calls
69+
{
70+
code: dedent`
71+
describe('my test suite', () => {
72+
test('should work', () => {
73+
expect(true).toBe(true);
74+
});
75+
});
76+
describe('my test suite', () => {
77+
test('should work', () => {
78+
expect(true).toBe(true);
79+
});
80+
});
81+
`,
82+
},
83+
],
84+
85+
invalid: [
86+
// Two apiTest.describe() calls
87+
{
88+
code: dedent`
89+
apiTest.describe('first suite', () => {
90+
apiTest('test 1', () => {});
91+
});
92+
93+
apiTest.describe('second suite', () => {
94+
apiTest('test 2', () => {});
95+
});
96+
`,
97+
errors: [
98+
{
99+
message: ERROR_MSG,
100+
},
101+
],
102+
},
103+
// Two test.describe() calls
104+
{
105+
code: dedent`
106+
test.describe('first suite', () => {
107+
test('test 1', () => {});
108+
});
109+
110+
test.describe('second suite', () => {
111+
test('test 2', () => {});
112+
});
113+
`,
114+
errors: [
115+
{
116+
message: ERROR_MSG,
117+
},
118+
],
119+
},
120+
// Two spaceTest.describe() calls
121+
{
122+
code: dedent`
123+
spaceTest.describe('first suite', () => {
124+
spaceTest('test 1', () => {});
125+
});
126+
127+
spaceTest.describe('second suite', () => {
128+
spaceTest('test 2', () => {});
129+
});
130+
`,
131+
errors: [
132+
{
133+
message: ERROR_MSG,
134+
},
135+
],
136+
},
137+
// Two different method describe calls
138+
{
139+
code: dedent`
140+
apiTest.describe('api describe', () => {
141+
test('test 1', () => {});
142+
});
143+
144+
test.describe('method describe', () => {
145+
test('test 2', () => {});
146+
});
147+
`,
148+
errors: [
149+
{
150+
message: ERROR_MSG,
151+
},
152+
],
153+
},
154+
// Three test.describe() calls - should report 2 errors
155+
{
156+
code: dedent`
157+
test.describe('first suite', () => {
158+
test('test 1', () => {});
159+
});
160+
161+
test.describe('second suite', () => {
162+
test('test 2', () => {});
163+
});
164+
165+
test.describe('third suite', () => {
166+
test('test 3', () => {});
167+
});
168+
`,
169+
errors: [
170+
{
171+
message: ERROR_MSG,
172+
},
173+
{
174+
message: ERROR_MSG,
175+
},
176+
],
177+
},
178+
// Multiple root describes of different types - now all count as violations
179+
{
180+
code: dedent`
181+
test.describe('test suite 1', () => {
182+
test('test 1', () => {});
183+
});
184+
185+
test.describe('test suite 2', () => {
186+
test('test 2', () => {});
187+
});
188+
189+
apiTest.describe('api suite 1', () => {
190+
apiTest('test 1', () => {});
191+
});
192+
193+
apiTest.describe('api suite 2', () => {
194+
apiTest('test 2', () => {});
195+
});
196+
`,
197+
errors: [
198+
{
199+
message: ERROR_MSG,
200+
},
201+
{
202+
message: ERROR_MSG,
203+
},
204+
{
205+
message: ERROR_MSG,
206+
},
207+
],
208+
},
209+
],
210+
});

src/platform/test/server_integration/http/ssl_with_p12_intermediate/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
export default function ({ getService }) {
1111
const supertest = getService('supertest');
1212

13-
describe('kibana server with ssl', function () {
13+
// Failing: See https://github.com/elastic/kibana/issues/248579
14+
describe.skip('kibana server with ssl', function () {
1415
this.tags('skipFIPS');
1516
it('handles requests using ssl with a P12 keystore that uses an intermediate CA', async () => {
1617
await supertest.get('/').expect(302);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# APM UI Metrics tab
2+
3+
When viewing a service in APM, the Metrics tab shows different things depending on the agent instrumenting the service.
4+
5+
See /x-pack/solutions/observability/plugins/apm/public/components/app/metrics/index.tsx.
6+
7+
## AWS Lambda
8+
9+
Lambda services render custom components in the Metrics tab.
10+
11+
## Static dashboards
12+
13+
The component uses `agent.name` and `telemetry.sdk.*` fields to determine if we have a static dashboard JSON file in the dashboards directory. If one of these matches, we load the JSON, set the data view values for each panel, and render an embedded dashboard onto the tab.
14+
15+
### Adding a new static dashboard
16+
17+
When adding a new static dashboard, if there are any panels on the dashboard that use ES|QL, you must replace the source used by all of the `FROM` (or `TS`, etc.) commands.
18+
19+
For example, if your dashboard was exported with `FROM metrics-apm*,apm-*`, this text must be replaced with `FROM {{indexPattern}}` in the dashboard JSON. The components in the tab will replace `{{indexPattern}}` with the current APM data view.
20+
21+
## JRuby (non-Lambda)
22+
23+
These services render custom JVM components in the Metrics tab.
24+
25+
## APM default fallback
26+
27+
If none of the above match, the service metrics for Elastic APM agents are rendered in the tab.

x-pack/solutions/observability/plugins/apm/public/components/app/metrics/index.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ import { FETCH_STATUS } from '../../../hooks/use_fetcher';
2020
import { fromQuery } from '../../shared/links/url_helpers';
2121
import { Metrics } from '.';
2222
import type { DataView } from '@kbn/data-views-plugin/common';
23+
import type { APMIndices } from '@kbn/apm-sources-access-plugin/public';
2324

2425
const KibanaReactContext = createKibanaReactContext({
2526
settings: { client: { get: () => {} } },
2627
} as unknown as Partial<CoreStart>);
2728

2829
function MetricsWithWrapper() {
29-
jest
30-
.spyOn(useApmDataViewHook, 'useAdHocApmDataView')
31-
.mockReturnValue({ dataView: { id: 'id-1', name: 'apm-data-view' } as DataView });
30+
jest.spyOn(useApmDataViewHook, 'useAdHocApmDataView').mockReturnValue({
31+
dataView: { id: 'id-1', name: 'apm-data-view' } as DataView,
32+
apmIndices: { metric: 'metrics*' } as APMIndices,
33+
});
3234

3335
const history = createMemoryHistory();
3436
history.replace({

x-pack/solutions/observability/plugins/apm/public/components/app/metrics/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function Metrics() {
2222
const { agentName, runtimeName, serverlessType, telemetrySdkName, telemetrySdkLanguage } =
2323
useApmServiceContext();
2424
const isAWSLambda = isAWSLambdaAgentName(serverlessType);
25-
const { dataView } = useAdHocApmDataView();
25+
const { dataView, apmIndices } = useAdHocApmDataView();
2626

2727
const hasDashboardFile = hasDashboard({ agentName, telemetrySdkName, telemetrySdkLanguage });
2828

@@ -51,6 +51,7 @@ export function Metrics() {
5151
runtimeName={runtimeName}
5252
serverlessType={serverlessType}
5353
dataView={dataView}
54+
apmIndices={apmIndices}
5455
/>
5556
);
5657
}

x-pack/solutions/observability/plugins/apm/public/components/app/metrics/static_dashboard/dashboards/opentelemetry_java.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)