Skip to content

Commit 0591abb

Browse files
authored
Merge branch 'main' into discover-logs-format-content
2 parents e6a28be + 62585da commit 0591abb

149 files changed

Lines changed: 4977 additions & 1426 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.

.buildkite/scout_ci_config.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ plugins:
55
- banners
66
- cloud_security_posture
77
- console
8+
- custom_branding
89
- dashboard
9-
- dashboard
10+
- data_views
1011
- discover_enhanced
1112
- entity_store
1213
- fleet
1314
- gen_ai_settings
1415
- global_search
1516
- index_management
1617
- infra
18+
- intercepts
1719
- lens
1820
- maps
1921
- observability
@@ -24,18 +26,14 @@ plugins:
2426
- search_homepage
2527
- security
2628
- security_solution
29+
- share
2730
- slo
2831
- spaces
2932
- streams
3033
- streams_app
3134
- transform
3235
- workflows_extensions
33-
- global_search
34-
- banners
3536
- workflows_management
36-
- intercepts
37-
- custom_branding
38-
- share
3937
disabled:
4038

4139
packages:

.buildkite/scripts/pipelines/pull_request/pipeline.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ const SKIPPABLE_PR_MATCHERS = prConfig.skip_ci_on_only_changed!.map((r) => new R
143143
/^x-pack\/platform\/plugins\/shared\/stack_connectors\/server\/connector_types\/openai/,
144144
/^x-pack\/platform\/plugins\/shared\/stack_connectors\/server\/connector_types\/inference/,
145145
];
146-
const agentBuilderPaths = [
147-
/^x-pack\/platform\/plugins\/shared\/agent_builder/,
148-
/^x-pack\/platform\/packages\/shared\/agent_builder/,
149-
];
146+
// const agentBuilderPaths = [
147+
// /^x-pack\/platform\/plugins\/shared\/agent_builder/,
148+
// /^x-pack\/platform\/packages\/shared\/agent_builder/,
149+
// ];
150150

151151
if (
152152
(await doAnyChangesMatch([...aiInfraPaths, ...aiConnectorPaths])) ||
@@ -156,8 +156,9 @@ const SKIPPABLE_PR_MATCHERS = prConfig.skip_ci_on_only_changed!.map((r) => new R
156156
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/ai_infra_gen_ai.yml'));
157157
}
158158

159+
// Temporarily disable auto-trigger on file changes - smoke tests still run daily
159160
if (
160-
(await doAnyChangesMatch([...aiInfraPaths, ...aiConnectorPaths, ...agentBuilderPaths])) ||
161+
// (await doAnyChangesMatch([...aiInfraPaths, ...aiConnectorPaths, ...agentBuilderPaths])) ||
161162
GITHUB_PR_LABELS.includes('agent-builder:run-smoke-tests') ||
162163
GITHUB_PR_LABELS.includes('ci:all-gen-ai-suites') ||
163164
ALL_UI_TEST_SUITES

.buildkite/scripts/steps/test/scout_test_run_builder.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ echo '--- Update Scout Test Config Manifests'
1111
node scripts/scout.js update-test-config-manifests
1212

1313
echo '--- Discover Playwright Configs and upload to Buildkite artifacts'
14-
node scripts/scout discover-playwright-configs --include-custom-servers --save
14+
if [[ "${BUILDKITE_BRANCH:-}" == "main" || "${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-}" == "main" ]]; then
15+
SCOUT_DISCOVERY_TARGET="local"
16+
else
17+
SCOUT_DISCOVERY_TARGET="local-stateful-only"
18+
fi
19+
node scripts/scout discover-playwright-configs \
20+
--include-custom-servers \
21+
--target "$SCOUT_DISCOVERY_TARGET" \
22+
--save
1523
cp .scout/test_configs/scout_playwright_configs.json scout_playwright_configs.json
1624
buildkite-agent artifact upload "scout_playwright_configs.json"
1725

src/core/packages/elasticsearch/server-internal/src/elasticsearch_config.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ test.skip('set correct defaults', () => {
7373
`);
7474
});
7575

76-
// FLAKY: https://github.com/elastic/kibana/issues/253373
77-
test.skip('set correct defaults (serverless)', () => {
76+
test('set correct defaults (serverless)', () => {
7877
const configValue = new ElasticsearchConfig(config.schema.validate({}, { serverless: true }));
7978
expect(configValue).toMatchInlineSnapshot(`
8079
ElasticsearchConfig {
@@ -84,6 +83,7 @@ test.skip('set correct defaults (serverless)', () => {
8483
"customHeaders": Object {},
8584
"dnsCacheTtl": "P0D",
8685
"healthCheckDelay": "PT2.5S",
86+
"healthCheckFailureInterval": undefined,
8787
"healthCheckRetry": 3,
8888
"healthCheckStartupDelay": "PT0.5S",
8989
"hosts": Array [

src/platform/packages/shared/deeplinks/security/deep_links.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export enum SecurityPageName {
9898
entityAnalyticsManagement = 'entity_analytics-management',
9999
entityAnalyticsLanding = 'entity_analytics-landing',
100100
entityAnalyticsPrivilegedUserMonitoring = 'entity_analytics-privileged_user_monitoring',
101+
entityAnalyticsWatchlists = 'entity_analytics-watchlists',
101102
entityAnalyticsOverview = 'entity_analytics-overview',
102103
entityAnalyticsThreatHunting = 'entity_analytics-threat_hunting',
103104
entityAnalyticsEntityStoreManagement = 'entity_analytics-entity_store_management',

src/platform/packages/shared/kbn-esql-language/src/commands/definitions/utils/promql.ts

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { withAutoSuggest } from './autocomplete/helpers';
2424
import { isIdentifier, isList, isSource } from '../../../ast/is';
2525
import { SuggestionCategory } from '../../../language/autocomplete/utils/sorting';
2626
import { techPreviewLabel } from './shared';
27+
import { arithmeticOperators } from '../all_operators';
2728

2829
const INDEX_PARAM_REGEX = /\bindex\s*=\s*(\S+)/i;
2930

@@ -65,22 +66,22 @@ const getPromqlFunctionSuggestion = (fn: PromQLFunctionDefinition): ISuggestionI
6566
};
6667

6768
/* Returns all PROMQL function suggestions suitable for autocomplete. */
68-
export const getPromqlFunctionSuggestions = (): ISuggestionItem[] => {
69+
const buildPromqlFunctionSuggestions = (): ISuggestionItem[] => {
6970
return promqlFunctionDefinitions
7071
.filter((fn) => !fn.ignoreAsSuggestion)
7172
.map((fn) => withAutoSuggest(getPromqlFunctionSuggestion(fn)));
7273
};
7374

74-
export const getPromqlFunctionSuggestionsForReturnTypes = (
75-
returnTypes: PromQLFunctionParamType[]
75+
export const getPromqlFunctionSuggestions = (
76+
returnTypes: PromQLFunctionParamType[] = []
7677
): ISuggestionItem[] => {
7778
if (!returnTypes.length) {
78-
return getPromqlFunctionSuggestions();
79+
return buildPromqlFunctionSuggestions();
7980
}
8081

8182
const allowed = new Set(returnTypes);
8283

83-
return getPromqlFunctionSuggestions().filter((suggestion) => {
84+
return buildPromqlFunctionSuggestions().filter((suggestion) => {
8485
const definition = getPromqlFunctionDefinition(suggestion.label);
8586
if (!definition?.signatures.length) {
8687
return false;
@@ -102,6 +103,22 @@ export const getPromqlFunctionDefinition = (
102103
return promqlFunctionDefinitions.find((fn) => fn.name.toLowerCase() === normalized);
103104
};
104105

106+
/* Returns the PromQL operator definition matching the provided operator symbol. */
107+
export const getPromqlOperatorDefinition = (
108+
operator: string | undefined
109+
): PromQLFunctionDefinition | undefined => {
110+
if (!operator) {
111+
return undefined;
112+
}
113+
114+
const normalized = operator.toLowerCase();
115+
return promqlOperatorDefinitions.find(
116+
({ operator: symbol, name, signatures }) =>
117+
(symbol ?? name)?.toLowerCase() === normalized &&
118+
signatures.some(({ params }) => params.length >= 2)
119+
);
120+
};
121+
105122
/* Extracts param types for a specific PromQL function parameter index. */
106123
export function getPromqlParamTypesForFunction(
107124
name: string | undefined,
@@ -146,13 +163,37 @@ const buildPromqlSymbolSuggestion = (definition: PromQLFunctionDefinition): ISug
146163
};
147164
};
148165

149-
/* Returns all PromQL operator suggestions suitable for autocomplete. */
166+
// TODO: Temporarily limited to arithmetic operators. Remove filter when comparison and logical operators are fully supported.
150167
export const getPromqlOperatorSuggestions = (): ISuggestionItem[] => {
151168
return promqlOperatorDefinitions
152-
.filter((op) => !op.ignoreAsSuggestion)
169+
.filter((op) => {
170+
const symbol = op.operator ?? op.name;
171+
172+
return (
173+
!op.ignoreAsSuggestion &&
174+
op.signatures.some((sig) => sig.params.length >= 2) &&
175+
(arithmeticOperators.some(({ name }) => name === symbol) || symbol === '^')
176+
);
177+
})
153178
.map((op) => buildPromqlSymbolSuggestion(op));
154179
};
155180

181+
/* Extracts rhs param types for a PromQL binary operator from operator signatures. */
182+
export const getBinaryOperatorParamTypes = (
183+
operator: string,
184+
paramIndex: number
185+
): PromQLFunctionParamType[] => {
186+
const definition = getPromqlOperatorDefinition(operator);
187+
188+
if (!definition) {
189+
return [];
190+
}
191+
192+
return definition.signatures
193+
.map((signature) => signature.params[paramIndex]?.type)
194+
.filter((paramType): paramType is PromQLFunctionParamType => Boolean(paramType));
195+
};
196+
156197
/* Returns all PromQL label matcher suggestions suitable for autocomplete. */
157198
export const getPromqlLabelMatcherSuggestions = (): ISuggestionItem[] => {
158199
return promqlLabelMatcherDefinitions

src/platform/packages/shared/kbn-esql-language/src/commands/registry/complete_items.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ export const promqlLabelSelectorItem: ISuggestionItem = withAutoSuggest({
211211
}),
212212
text: '{$0}',
213213
asSnippet: true,
214-
kind: 'Operator',
214+
kind: 'Reference',
215215
detail: i18n.translate('kbn-esql-language.esql.autocomplete.promql.labelSelectorDoc', {
216216
defaultMessage: 'Filter by labels',
217217
}),
218+
category: SuggestionCategory.PROMQL_METRIC_QUALIFIER,
218219
});
219220

220221
export const promqlRangeSelectorItem: ISuggestionItem = withAutoSuggest({
@@ -223,10 +224,11 @@ export const promqlRangeSelectorItem: ISuggestionItem = withAutoSuggest({
223224
}),
224225
text: '[${0:5m}]',
225226
asSnippet: true,
226-
kind: 'Operator',
227+
kind: 'Reference',
227228
detail: i18n.translate('kbn-esql-language.esql.autocomplete.promql.rangeSelectorDoc', {
228229
defaultMessage: 'Range selector (duration)',
229230
}),
231+
category: SuggestionCategory.PROMQL_METRIC_QUALIFIER,
230232
});
231233

232234
export const byCompleteItem: ISuggestionItem = withAutoSuggest({

src/platform/packages/shared/kbn-esql-language/src/commands/registry/promql/autocomplete.test.ts

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import {
1818
promqlLabelSelectorItem,
1919
promqlRangeSelectorItem,
2020
} from '../complete_items';
21-
import { getPromqlFunctionSuggestions } from '../../definitions/utils/promql';
21+
import {
22+
getPromqlFunctionSuggestions,
23+
getPromqlOperatorSuggestions,
24+
} from '../../definitions/utils/promql';
2225
import { ESQL_NUMBER_TYPES, ESQL_STRING_TYPES } from '../../definitions/types';
2326
import { getPromqlParam, PROMQL_PARAM_NAMES } from './utils';
2427
import { TIME_SYSTEM_PARAMS } from '../../definitions/utils/literals';
@@ -28,6 +31,7 @@ import type { ICommandCallbacks, ICommandContext } from '../types';
2831
const promqlParamItems = getPromqlParamKeySuggestions();
2932
const promqlParamTexts = promqlParamItems.map(({ text }) => text);
3033
const promqlFunctionSuggestions = getPromqlFunctionSuggestions();
34+
const promqlOperatorLabels = getPromqlOperatorSuggestions().map(({ label }) => label);
3135
const promqlFunctionLabels = promqlFunctionSuggestions.map(({ label }) => label);
3236
const promqlFunctionWrappedTexts = promqlFunctionSuggestions
3337
.slice(0, 1)
@@ -465,6 +469,23 @@ describe('inside query', () => {
465469
});
466470
});
467471

472+
test('suggests operators after complete expression inside aggregation', async () => {
473+
const query = 'PROMQL step="5m" sum(rate(doubleField[5m]) ';
474+
475+
await expectPromqlSuggestions(query, {
476+
labelsContain: promqlOperatorLabels,
477+
});
478+
});
479+
480+
test('suggests operands (not operators) after binary operator inside aggregation', async () => {
481+
const query = 'PROMQL step="5m" sum(rate(doubleField[5m]) * ';
482+
483+
await expectPromqlSuggestions(query, {
484+
labelsContain: ['rate', 'sum', 'avg'],
485+
labelsNotContain: promqlOperatorLabels,
486+
});
487+
});
488+
468489
test('excludes user-defined columns from field suggestions', async () => {
469490
await expectPromqlSuggestions('PROMQL sum( ', {
470491
labelsNotContain: ['var0', 'col0'],
@@ -722,6 +743,62 @@ describe('after query (pipe suggestions)', () => {
722743
textsNotContain: [pipeCompleteItem.text],
723744
});
724745
});
746+
747+
test('suggests RHS operand items after arithmetic operator at query boundary', async () => {
748+
const numericFields = getFieldNamesByType(ESQL_NUMBER_TYPES, true);
749+
const query = 'PROMQL step="5m" (sum(rate(doubleField[5m]))) + ';
750+
751+
await expectPromqlSuggestions(
752+
query,
753+
{
754+
labelsContain: ['abs', ...numericFields],
755+
textsContain: ['${0:0}'],
756+
textsNotContain: [pipeCompleteItem.text, promqlByCompleteItem.text],
757+
},
758+
mockCallbacks
759+
);
760+
});
761+
762+
test('suggests RHS operand items after operator following selector with labels', async () => {
763+
const numericFields = getFieldNamesByType(ESQL_NUMBER_TYPES, true);
764+
const query = 'PROMQL step="5m" quantile(0, doubleField{label!~"value"} * ';
765+
766+
await expectPromqlSuggestions(
767+
query,
768+
{
769+
labelsContain: numericFields,
770+
textsContain: ['${0:0}'],
771+
},
772+
mockCallbacks
773+
);
774+
});
775+
776+
test('suggests RHS operand items after minus operator', async () => {
777+
const numericFields = getFieldNamesByType(ESQL_NUMBER_TYPES, true);
778+
const query = 'PROMQL step="5m" quantile(0, doubleField - ';
779+
780+
await expectPromqlSuggestions(
781+
query,
782+
{
783+
labelsContain: numericFields,
784+
textsContain: ['${0:0}'],
785+
},
786+
mockCallbacks
787+
);
788+
});
789+
790+
test('suggests label selector after metric name in RHS of operator', async () => {
791+
const query =
792+
'PROMQL index=tsdb_index step="5m" sum(quantile(0.9, doubleField{label!~"value"} * doubleField ';
793+
794+
await expectPromqlSuggestions(
795+
query,
796+
{
797+
textsContain: [promqlLabelSelectorItem.text],
798+
},
799+
mockCallbacks
800+
);
801+
});
725802
});
726803

727804
describe('param value suggestions', () => {

0 commit comments

Comments
 (0)