[ES|QL] METRICS_INFO support: columns_after & summary#256758
[ES|QL] METRICS_INFO support: columns_after & summary#256758momovdg merged 12 commits intoelastic:mainfrom
Conversation
57c343e to
4154010
Compare
|
Pinging @elastic/kibana-esql (Team:ESQL) |
stratoula
left a comment
There was a problem hiding this comment.
Looks nice! some comments from the review!
There was a problem hiding this comment.
Can we keep the same logic as in src/platform/packages/shared/kbn-esql-language/src/commands/registry/registered_domain/columns_after.ts ?
Mostly for consistency (plus you dont need to add the userDefined: false everywhere)
| type?: 'source' | 'header' | 'processing'; // Optional property to classify the command type | ||
| isTimeseries?: boolean; // Optional property to indicate if the command is a timeseries source command | ||
| requiresTimeseriesSource?: boolean; // Optional property to indicate the command is only available when the source command is TS | ||
| notAfterCommands?: string[]; // Optional list of command names after which this command should not be suggested (e.g. METRICS_INFO not after STATS) |
There was a problem hiding this comment.
| notAfterCommands?: string[]; // Optional list of command names after which this command should not be suggested (e.g. METRICS_INFO not after STATS) | |
| hiddenAfterCommands?: string[]; // Optional list of command names after which this command should not be suggested (e.g. METRICS_INFO not after STATS) |
| } | ||
| return true; | ||
| }) | ||
| .filter((command) => { |
There was a problem hiding this comment.
You only check the last command, this means that
TS kibana_sample_data_logstsdb | STATS x = count( event.dataset) |
will suggest metrics info while it should not
This should make it work as we want
.filter((command) => {
const hiddenAfter = command.metadata?.hiddenAfterCommands;
if (hiddenAfter?.length) {
return !astContext.astForContext.commands.some(
(cmd) => hiddenAfter.includes(cmd.name)
);
}
return true;
})
| }), | ||
| declaration: 'METRICS_INFO', | ||
| examples: ['TS index | METRICS_INFO'], | ||
| preview: false, |
There was a problem hiding this comment.
| preview: false, | |
| preview: true, |
| _command: ESQLCommand, | ||
| previousColumns: ESQLColumnData[], | ||
| _query: string | ||
| ) => { |
There was a problem hiding this comment.
| ) => { | |
| ) : ESQLColumnData[] => { |
| it('returns exactly the fixed set of metrics info columns', () => { | ||
| const result = summary(mockCommand); | ||
|
|
||
| expect(result.newColumns).toEqual( |
There was a problem hiding this comment.
Dont hardcode them, we have them in a constant, no?
| declaration: 'METRICS_INFO', | ||
| examples: ['TS index | METRICS_INFO'], | ||
| preview: false, | ||
| hidden: false, |
There was a problem hiding this comment.
| hidden: false, |
stratoula
left a comment
There was a problem hiding this comment.
This looks great now! Thanks
💛 Build succeeded, but was flaky
Failed CI Steps
Test Failures
Metrics [docs]Module Count
Page load bundle
History
cc @momovdg |
…e_fix * commit '565f7545c422192218b803874fbdf93e8d8f08ee': (27 commits) [Lens API] ESQL schema for XY separately for Agent and some small token optimizations (elastic#256885) Fix "Accessing resource attributes before async attributes settled" telemetry error (elastic#256880) [Security Solution][Attacks/Alerts][Attacks page][Table section] Preserver "Sort by" state on Attacks page (elastic#256717) (elastic#256795) [APM] Improve redirect with default date range guard (elastic#256887) [Security Solution][Attacks/Alerts][Attacks page][Table section] Add assignees avatars to the group component (elastic#250126) (elastic#256901) [Docs] add xpack.alerting.rules.maxScheduledPerMinute setting description (elastic#257041) [SO] Fix non-deterministic ordering in nested find API integration tests (elastic#256447) [Write-restricted dashboards] Update user profile retrieval for getShouldAddAccessControl (elastic#255065) [One Workflow] Add Scout API test scaffold and execution tests (elastic#256300) [Fleet] add use_apm if dynamic_signal_types are enabled (elastic#256429) [Fleet] ignore data streams starting with `.` in Fleet API (elastic#256625) [ES|QL] METRICS_INFO support: columns_after & summary (elastic#256758) [Agent Builder] Agent plugins: initial installation support (elastic#256478) [Streams] Add field descriptions and documentation-only field overrides (elastic#255136) [api-docs] 2026-03-11 Daily api_docs build (elastic#257023) [Security Solution] fix alerts page infinite loading state due to data view error (elastic#256983) [Logging] Add `service.*` global fields (elastic#256878) [Canvas] Apply embeddable transforms to embeddable elements (elastic#252191) [table_list_view_table] stabilize jest test (elastic#254991) [Obs AI] get_index_info: add unit tests (elastic#256802) ...
part of #255433 ## Summary Adds support for METRICS_INFO command. - implements [columns_after](src/platform/packages/shared/kbn-esql-language/src/commands/registry/metrics_info/columns_after.ts) and [summary](src/platform/packages/shared/kbn-esql-language/src/commands/registry/metrics_info/summary.ts) - should only be available for TS - should not be suggested after STATS ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
part of #255433
Summary
Adds support for METRICS_INFO command.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:*label is applied per the guidelinesbackport:*labels.