Skip to content

[Metrics][Discover] Build Metrics Grid chart from METRICS_INFO response#257206

Merged
kpatticha merged 29 commits intoelastic:mainfrom
kpatticha:metrics_info_metrics_expr
Mar 17, 2026
Merged

[Metrics][Discover] Build Metrics Grid chart from METRICS_INFO response#257206
kpatticha merged 29 commits intoelastic:mainfrom
kpatticha:metrics_info_metrics_expr

Conversation

@kpatticha
Copy link
Copy Markdown
Contributor

@kpatticha kpatticha commented Mar 11, 2026

close #253717
close #253435

Summary

Changes how the Metrics experience grid is built and rendered: we no longer use Field Caps and now rely on the ES|QL METRICS_INFO pipeline as the single source of metris grid. Data is fetched, parsed, and typed in kbn-unified-chart-section-viewer.

Major changes

  • Data source: Grid is driven by METRICS_INFO instead of Field Caps. Fetch via useFetchMetricsData (ES|QL + | METRICS_INFO), parse with parseMetricsResponse; grid and toolbar consume metricItems and allDimensions from this hook.
  • Filtering: When multiple dimension names are selected, a WHERE dimension filter (e.g. field IS NOT NULL) is applied in buildMetricsInfoQuery before METRICS_INFO.
  • Types: ParsedMetricItem and ParsedMetricsResult describe the flow; grid, chart layers, flyout, and content use this shape (metricName, dataStream, fieldTypes, metricTypes, units, dimensionFields). Public API exports ParsedMetricItem, ParsedMetricsResult, MetricsInfoResponse, MetricsESQLResponseObject, Dimension, MetricUnit, UnifiedMetricsGridProps.
  • Naming: Parser returns metricItems / allDimensions; hook returns metricItems;
  • Search/filter: Client-side only via useMetricFieldsFilter and filteredMetricItems (no Field Caps).
  • Tests: Updated and added mocks for useFetchMetricsData, useMetricFieldsFilter, and related hooks.

Behavior

  • SORT only: FROM x | SORT timestamp DESCFROM x | METRICS_INFO (SORT removed).
  • LIMIT only: FROM x | LIMIT 10FROM x | METRICS_INFO | LIMIT 10.
  • SORT + LIMIT: FROM x | SORT ts | LIMIT 100FROM x | METRICS_INFO | LIMIT 100.
  • WHERE + SORT + LIMIT: Existing WHERE is kept; SORT is removed; LIMIT is re-appended after METRICS_INFO.

Not addressed

  • Multi-value in flyout: Handling/display of multi-value fields in the metric insights flyout will be done in a separate ticket.
  • Dimension/Naming refactor: Simplification of dimension handling (e.g. Dimension[] vs string[], selector, state) is out of scope here and will be done in a separate change. Keep the Dimension[] type
Screen.Recording.2026-03-13.at.4.32.14.PM.mov

How to test

  1. use https://github.com/simianhacker/simian-forge
  2. run npm run build
  3. ./forge --dataset histograms --count 3 --interval 10s
  4. go to discover

- Introduced `fetchMetricsInfo` and `parseMetricsInfoResponse` functions to handle fetching and parsing of metrics information.
- Updated existing components to utilize the new metrics info structure, including adjustments to metric fields and dimensions.
- Added utility functions for normalizing and appending metrics info queries.
- Implemented tests for new functionalities to ensure reliability and correctness.

This update improves the overall metrics experience by providing a more structured approach to handling metrics data.
@@ -1,67 +0,0 @@
/*
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I just moved this file

@@ -41,14 +41,17 @@ export const OverviewTab = ({ metric, description }: OverviewTabProps) => {
const [itemsPerPage, setItemsPerPage] = useState(DEFAULT_PAGINATION_SIZE);
const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null);

const unitLabel = useMemo(() => getUnitLabel({ unit: metric.unit }), [metric.unit]);
const unitLabel = useMemo(
Copy link
Copy Markdown
Contributor Author

@kpatticha kpatticha Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multi value for all field in the flyout it will be handled in a follow up ticket: #253718

@kpatticha
Copy link
Copy Markdown
Contributor Author

/oblt-deploy

Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for sharing! Overall, I agree with the approach. I’ll let you mark the PR as ready for review before adding the comments, and I’ll keep an eye on it so I can provide quick feedback.

@kpatticha kpatticha marked this pull request as ready for review March 12, 2026 16:58
@kpatticha kpatticha requested a review from a team as a code owner March 12, 2026 16:58
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod Bot requested a review from a team as a code owner March 12, 2026 17:19
Copy link
Copy Markdown
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I did an initial review. I commented on a couple type errors but tried to stick more toward things I think would be useful as initial feedback.

One thing I noticed in practical testing is if I click a breakdown field from Discover's fields list, basically nothing happens. Are we considering how this will interact with fields that don't display in the Dimensions dropdown list, but do display in Discover's fields list?

Comment thread src/platform/packages/shared/kbn-unified-chart-section-viewer/index.ts Outdated
Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I left some comments. I haven’t finished the review yet, so I’ll continue, but I wanted to give you some initial feedback.

Comment thread src/platform/packages/shared/kbn-unified-chart-section-viewer/src/types.ts Outdated
Comment thread src/platform/packages/shared/kbn-unified-chart-section-viewer/src/types.ts Outdated
Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few more comments. I didn’t review the tests or related things yet, I’ll let you finish that part first before making any noise and then I'll do a second round of review. I’ll also trigger the E2E tests to save some CI time

@lucaslopezf
Copy link
Copy Markdown
Contributor

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:1

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11087

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x1

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#11087

[✅] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 1/1 tests passed.

see run history

Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! We’re really close! Regardless of the comments (nits), while looking at the E2E tests I realized that tests related to queries like TS metrics-* | SORT @timestamp DESC are not working. I tested it locally and the same thing happens

@kpatticha
Copy link
Copy Markdown
Contributor Author

Nice!! We’re really close! Regardless of the comments (nits), while looking at the E2E tests I realized that tests related to queries like TS metrics-* | SORT @timestamp DESC are not working. I tested it locally and the same thing happens

Yes, these test are gold.

It turns out that we cannot use METRICS_INFO after limit and sort. https://github.com/elastic/elasticsearch/blob/44207cb2e522baa392ba84d18ba0ac83ca1da24b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java#L3762-L3768 .

I'm fixing the limit but for sort I will remove it for now and create a seperate ticket cause I need product input on this

@kpatticha
Copy link
Copy Markdown
Contributor Author

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kpatticha
Copy link
Copy Markdown
Contributor Author

/oblt-deploy

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11103

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11103

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 25/30 tests passed.

see run history

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 1988 1989 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/unified-chart-section-viewer 3 31 +28

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.6MB 1.6MB -1.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/unified-chart-section-viewer 3 2 -1
@kbn/unified-histogram 11 12 +1
total -0
Unknown metric groups

API count

id before after diff
@kbn/unified-chart-section-viewer 5 35 +30

History

@lucaslopezf lucaslopezf added the Team:obs-exploration Observability Exploration team label Mar 17, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-exploration-team (Team:obs-exploration)

@lucaslopezf
Copy link
Copy Markdown
Contributor

/flaky scoutConfig:src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts:30

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner

✅ Build triggered - kibana-flaky-test-suite-runner#11111

  • src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts x30

Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work 🚀 !! Everything looks good to me! Let’s just wait for the flaky tool before merging, and “fix” any flaky tests if we find any

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#11111

[❌] src/platform/plugins/shared/discover/test/scout/ui/parallel.playwright.config.ts: 26/30 tests passed.

see run history

@kpatticha
Copy link
Copy Markdown
Contributor Author

The flaky tests failed again, 26/30 but I'm going to merge this PR and fix this in a follow up

@kpatticha kpatticha merged commit 71abf0f into elastic:main Mar 17, 2026
20 checks passed
lucaslopezf added a commit that referenced this pull request Mar 18, 2026
…metrics experience tests (#258274)

Closes: #258227

## Summary

The test used a relative time range (`Last 30 days`) that doesn't
overlap with the test data (Jan 2025), so the `METRICS_INFO` query
returns empty results and the grid disappears. Replaced with an absolute
range (`Jan 1 – Jun 30, 2025`) that covers the test data while still
validating grid persistence across time range changes.

Surfaced by #257206, which switched to time-range-aware `METRICS_INFO`
queries. The test had a latent bug (relative date with no data) that was
previously masked by the old field-metadata-based approach.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
szwarckonrad pushed a commit to szwarckonrad/kibana that referenced this pull request Mar 18, 2026
…metrics experience tests (elastic#258274)

Closes: elastic#258227

## Summary

The test used a relative time range (`Last 30 days`) that doesn't
overlap with the test data (Jan 2025), so the `METRICS_INFO` query
returns empty results and the grid disappears. Replaced with an absolute
range (`Jan 1 – Jun 30, 2025`) that covers the test data while still
validating grid persistence across time range changes.

Surfaced by elastic#257206, which switched to time-range-aware `METRICS_INFO`
queries. The test had a latent bug (relative date with no data) that was
previously masked by the old field-metadata-based approach.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 18, 2026
…se (elastic#257206)

close  elastic#253717
close elastic#253435 


## Summary
Changes how the Metrics experience grid is built and rendered: we no
longer use Field Caps and now rely on the ES|QL `METRICS_INFO` pipeline
as the single source of metris grid. Data is fetched, parsed, and typed
in `kbn-unified-chart-section-viewer`.

## Major changes
- **Data source**: Grid is driven by METRICS_INFO instead of Field Caps.
Fetch via `useFetchMetricsData` (ES|QL + `| METRICS_INFO`), parse with
`parseMetricsResponse`; grid and toolbar consume `metricItems` and
`allDimensions` from this hook.
- **Filtering**: When multiple dimension names are selected, a WHERE
dimension filter (e.g. `field IS NOT NULL`) is applied in
`buildMetricsInfoQuery` before `METRICS_INFO`.
- **Types**: `ParsedMetricItem` and `ParsedMetricsResult` describe the
flow; grid, chart layers, flyout, and content use this shape
(`metricName`, `dataStream`, `fieldTypes`, `metricTypes`, `units`,
`dimensionFields`). Public API exports `ParsedMetricItem`,
`ParsedMetricsResult`, `MetricsInfoResponse`,
`MetricsESQLResponseObject`, `Dimension`, `MetricUnit`,
`UnifiedMetricsGridProps`.
- **Naming**: Parser returns `metricItems` / `allDimensions`; hook
returns `metricItems`;
- **Search/filter**: Client-side only via `useMetricFieldsFilter` and
`filteredMetricItems` (no Field Caps).
- **Tests**: Updated and added mocks for `useFetchMetricsData`,
`useMetricFieldsFilter`, and related hooks.

## Behavior

- **SORT only:** `FROM x | SORT timestamp DESC` → `FROM x |
METRICS_INFO` (SORT removed).
- **LIMIT only:** `FROM x | LIMIT 10` → `FROM x | METRICS_INFO | LIMIT
10`.
- **SORT + LIMIT:** `FROM x | SORT ts | LIMIT 100` → `FROM x |
METRICS_INFO | LIMIT 100`.
- **WHERE + SORT + LIMIT:** Existing WHERE is kept; SORT is removed;
LIMIT is re-appended after METRICS_INFO.

##  Not addressed 
- **Multi-value in flyout**: Handling/display of multi-value fields in
the metric insights flyout will be done in a separate ticket.
- ~**Dimension/Naming refactor**: Simplification of dimension handling
(e.g. `Dimension[]` vs `string[]`, selector, state) is out of scope here
and will be done in a separate change.~ Keep the Dimension[] type


https://github.com/user-attachments/assets/0d865735-ac21-418e-9fb0-16078dfc52f2

## How to test
1. use https://github.com/simianhacker/simian-forge
2. run `npm run build`
3. `./forge --dataset histograms --count 3 --interval 10s`
4. go to discover

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lucas Francisco López <lucaslopezf@gmail.com>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 18, 2026
…metrics experience tests (elastic#258274)

Closes: elastic#258227

## Summary

The test used a relative time range (`Last 30 days`) that doesn't
overlap with the test data (Jan 2025), so the `METRICS_INFO` query
returns empty results and the grid disappears. Replaced with an absolute
range (`Jan 1 – Jun 30, 2025`) that covers the test data while still
validating grid persistence across time range changes.

Surfaced by elastic#257206, which switched to time-range-aware `METRICS_INFO`
queries. The test had a latent bug (relative date with no data) that was
previously masked by the old field-metadata-based approach.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…se (elastic#257206)

close  elastic#253717
close elastic#253435 


## Summary
Changes how the Metrics experience grid is built and rendered: we no
longer use Field Caps and now rely on the ES|QL `METRICS_INFO` pipeline
as the single source of metris grid. Data is fetched, parsed, and typed
in `kbn-unified-chart-section-viewer`.

## Major changes
- **Data source**: Grid is driven by METRICS_INFO instead of Field Caps.
Fetch via `useFetchMetricsData` (ES|QL + `| METRICS_INFO`), parse with
`parseMetricsResponse`; grid and toolbar consume `metricItems` and
`allDimensions` from this hook.
- **Filtering**: When multiple dimension names are selected, a WHERE
dimension filter (e.g. `field IS NOT NULL`) is applied in
`buildMetricsInfoQuery` before `METRICS_INFO`.
- **Types**: `ParsedMetricItem` and `ParsedMetricsResult` describe the
flow; grid, chart layers, flyout, and content use this shape
(`metricName`, `dataStream`, `fieldTypes`, `metricTypes`, `units`,
`dimensionFields`). Public API exports `ParsedMetricItem`,
`ParsedMetricsResult`, `MetricsInfoResponse`,
`MetricsESQLResponseObject`, `Dimension`, `MetricUnit`,
`UnifiedMetricsGridProps`.
- **Naming**: Parser returns `metricItems` / `allDimensions`; hook
returns `metricItems`;
- **Search/filter**: Client-side only via `useMetricFieldsFilter` and
`filteredMetricItems` (no Field Caps).
- **Tests**: Updated and added mocks for `useFetchMetricsData`,
`useMetricFieldsFilter`, and related hooks.

## Behavior

- **SORT only:** `FROM x | SORT timestamp DESC` → `FROM x |
METRICS_INFO` (SORT removed).
- **LIMIT only:** `FROM x | LIMIT 10` → `FROM x | METRICS_INFO | LIMIT
10`.
- **SORT + LIMIT:** `FROM x | SORT ts | LIMIT 100` → `FROM x |
METRICS_INFO | LIMIT 100`.
- **WHERE + SORT + LIMIT:** Existing WHERE is kept; SORT is removed;
LIMIT is re-appended after METRICS_INFO.

##  Not addressed 
- **Multi-value in flyout**: Handling/display of multi-value fields in
the metric insights flyout will be done in a separate ticket.
- ~**Dimension/Naming refactor**: Simplification of dimension handling
(e.g. `Dimension[]` vs `string[]`, selector, state) is out of scope here
and will be done in a separate change.~ Keep the Dimension[] type


https://github.com/user-attachments/assets/0d865735-ac21-418e-9fb0-16078dfc52f2

## How to test
1. use https://github.com/simianhacker/simian-forge
2. run `npm run build`
3. `./forge --dataset histograms --count 3 --interval 10s`
4. go to discover

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lucas Francisco López <lucaslopezf@gmail.com>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…metrics experience tests (elastic#258274)

Closes: elastic#258227

## Summary

The test used a relative time range (`Last 30 days`) that doesn't
overlap with the test data (Jan 2025), so the `METRICS_INFO` query
returns empty results and the grid disappears. Replaced with an absolute
range (`Jan 1 – Jun 30, 2025`) that covers the test data while still
validating grid persistence across time range changes.

Surfaced by elastic#257206, which switched to time-range-aware `METRICS_INFO`
queries. The test had a latent bug (relative date with no data) that was
previously masked by the old field-metadata-based approach.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] 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)
- [ ] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-exploration Observability Exploration team v9.4.0

Projects

None yet

6 participants