Skip to content

[ML] Move duplicate Single Metric Viewer code to single location#263155

Merged
alvarezmelissa87 merged 21 commits into
elastic:mainfrom
alvarezmelissa87:ml-smv-refactor
May 4, 2026
Merged

[ML] Move duplicate Single Metric Viewer code to single location#263155
alvarezmelissa87 merged 21 commits into
elastic:mainfrom
alvarezmelissa87:ml-smv-refactor

Conversation

@alvarezmelissa87
Copy link
Copy Markdown
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Apr 14, 2026

Summary

Fixes #201020

This PR implements a Single Metric Viewer (SMV) / time series chart refactor: logic that used to live in two places (timeseriesexplorer.js and timeseriesexplorer_embeddable_chart.js) is centralized under a new timeseriesexplorer_chart_controller area so the full-page Time Series Explorer and the embeddable chart share one implementation.

Details

Under the new shared module, timeseriesexplorer_chart_controller/ :

  • Data loading — load_single_metric_context_data.ts
  • Host (full-page Time Series Explorer and the embeddable SMV chart) wiring — smv_host_wiring.ts
  • Zoom / context chart pipeline — context_chart_zoom_pipeline.ts
  • Focus range resolution — resolve_context_finish_focus_range.ts
  • Table / anomaly helpers — e.g. anomalies_table_data.ts, normalize_table_severity.ts, entity_partition_helpers.ts
  • React surface / hooks — single_metric_viewer_chart_surface.tsx, use_single_metric_viewer_chart_model.ts, partition_fields_required_callout.tsx
  • Barrel — index.ts
SMV-no-split.mov
SMV-with-split.mov
SMV-tables-under.mov

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, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests 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
  • 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 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
  • Review the backport guidelines 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.

@alvarezmelissa87 alvarezmelissa87 self-assigned this Apr 14, 2026
@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

/ci

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

/ci

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

/ci

@alvarezmelissa87 alvarezmelissa87 changed the title move duplicate smv code to single location [ML] Move duplicate Single Metric Viewer code to single location Apr 15, 2026
@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

/ci

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

/ci

@alvarezmelissa87 alvarezmelissa87 marked this pull request as ready for review April 22, 2026 16:39
@alvarezmelissa87 alvarezmelissa87 requested a review from a team as a code owner April 22, 2026 16:39
@alvarezmelissa87 alvarezmelissa87 added :ml Feature:Anomaly Detection ML anomaly detection release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Apr 22, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

⏳ Build in-progress, with failures

Failed CI Steps

History

cc @alvarezmelissa87

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and couldn't find any regressions in the ML Single Metric Viewer or the dashboard panel. Just left a couple of comments.

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

LGTM
Nice refactor

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

This has been updated and is ready for a final look when you get a chance. 🙏 cc @peteharverson

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

LGTM. Gave it another test, in the ML view and for the embeddable in Dashboard and Cases.

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 4268 4280 +12

Async chunks

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

id before after diff
ml 5.6MB 5.6MB +3.1KB

History

cc @alvarezmelissa87

@alvarezmelissa87
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #193 / discover/ccs_compatible discover search CCS cancel classic mode should show warning and results
  • [job] [logs] FTR Configs #160 / integrations When in the Fleet application and on the Endpoint Integration details page should show the Trusted Apps page when link is clicked

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 4266 4278 +12

Async chunks

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

id before after diff
ml 5.6MB 5.6MB +3.1KB

History

cc @alvarezmelissa87

@alvarezmelissa87 alvarezmelissa87 merged commit 831a342 into elastic:main May 4, 2026
25 checks passed
@alvarezmelissa87 alvarezmelissa87 deleted the ml-smv-refactor branch May 4, 2026 16:14
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 Feature:Anomaly Detection ML anomaly detection :ml release_note:skip Skip the PR/issue when compiling release notes v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ML] Anomaly Detection: Single Metric Viewer embeddable refactor

6 participants