…om the full-screen waterfall (#224033) (#224422)
# Backport
This will backport the following commits from `main` to `8.19`:
- [[Discover][APM] Add link to view related errors in Discover from the
full-screen waterfall
(#224033)](#224033)
<!--- Backport version: 10.0.1 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Irene
Blanco","email":"irene.blanco@elastic.co"},"sourceCommit":{"committedDate":"2025-06-18T11:02:04Z","message":"[Discover][APM]
Add link to view related errors in Discover from the full-screen
waterfall (#224033)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/222591\n\nThis PR adds the link
to the “View related error” / \"View X related\nerrors\" badge in the
full-screen waterfall.\n\nUnlike the same badge in APM, here it’s
handled as a native `href`, so\nthe user keeps the option to open it in
a new tab—avoiding loss of\ncontext from Discover if they prefer.\n\n
**Highlights**\n\n* Created `ApmErrorsContextService` to access the
configured APM error\nindices.\n\n* I had considered merging this with
`TracesContextService` into a\nshared `ApmContextService` (for both
traces and errors), but decided to\nkeep them separate to avoid mixing
methods and logic. Totally open to\nrevisit this if anyone feels that a
shared service would make things\ncleaner or more maintainable.\n\n*
Created `DataSourcesProvider` to easily access the relevant
indices\nwithin our flyouts.\n\n* Built the Discover URL using the
locator, preparing an ESQL query to\nfilter by `span.id` and `trace.id`
across both error and log indices.\n\n* Added `getRelatedErrorsHref` as
a prop to `TraceWaterfallEmbeddable`,\nallowing us to pass the errors
URL directly.\n\n* Why this approach instead of triggering a callback to
the parent? We\nwanted to preserve native link behavior (e.g., open in
new tab), which\nwouldn't work if navigation was handled via
`navigateTo` from the\nparent.\n\n* Created `EmbeddableRelatedErrors` to
handle the badge link.\n\n* Agreed with the EUI team to cast the `href`
as `any`, since due to the\ncomponent nesting in the waterfall, it was
the cleanest way to make the\nnative link behavior work in this
context.\n\n* Created `ExitFullScreenButton` wrapper to enable exiting
full-screen\nmode with the `ESC`
key.\n\n\n\nhttps://github.com/user-attachments/assets/d3e476ae-ee10-410f-b003-02521dc35e13\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Carlos Crespo <crespocarlos@users.noreply.github.com>\nCo-authored-by:
Milosz Marcinkowski
<38698566+miloszmarcinkowski@users.noreply.github.com>","sha":"87cb7685888f21b0f9d2a2467f47701364535b44","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[Discover][APM]
Add link to view related errors in Discover from the full-screen
waterfall
","number":224033,"url":"https://github.com/elastic/kibana/pull/224033","mergeCommit":{"message":"[Discover][APM]
Add link to view related errors in Discover from the full-screen
waterfall (#224033)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/222591\n\nThis PR adds the link
to the “View related error” / \"View X related\nerrors\" badge in the
full-screen waterfall.\n\nUnlike the same badge in APM, here it’s
handled as a native `href`, so\nthe user keeps the option to open it in
a new tab—avoiding loss of\ncontext from Discover if they prefer.\n\n
**Highlights**\n\n* Created `ApmErrorsContextService` to access the
configured APM error\nindices.\n\n* I had considered merging this with
`TracesContextService` into a\nshared `ApmContextService` (for both
traces and errors), but decided to\nkeep them separate to avoid mixing
methods and logic. Totally open to\nrevisit this if anyone feels that a
shared service would make things\ncleaner or more maintainable.\n\n*
Created `DataSourcesProvider` to easily access the relevant
indices\nwithin our flyouts.\n\n* Built the Discover URL using the
locator, preparing an ESQL query to\nfilter by `span.id` and `trace.id`
across both error and log indices.\n\n* Added `getRelatedErrorsHref` as
a prop to `TraceWaterfallEmbeddable`,\nallowing us to pass the errors
URL directly.\n\n* Why this approach instead of triggering a callback to
the parent? We\nwanted to preserve native link behavior (e.g., open in
new tab), which\nwouldn't work if navigation was handled via
`navigateTo` from the\nparent.\n\n* Created `EmbeddableRelatedErrors` to
handle the badge link.\n\n* Agreed with the EUI team to cast the `href`
as `any`, since due to the\ncomponent nesting in the waterfall, it was
the cleanest way to make the\nnative link behavior work in this
context.\n\n* Created `ExitFullScreenButton` wrapper to enable exiting
full-screen\nmode with the `ESC`
key.\n\n\n\nhttps://github.com/user-attachments/assets/d3e476ae-ee10-410f-b003-02521dc35e13\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Carlos Crespo <crespocarlos@users.noreply.github.com>\nCo-authored-by:
Milosz Marcinkowski
<38698566+miloszmarcinkowski@users.noreply.github.com>","sha":"87cb7685888f21b0f9d2a2467f47701364535b44"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224033","number":224033,"mergeCommit":{"message":"[Discover][APM]
Add link to view related errors in Discover from the full-screen
waterfall (#224033)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/222591\n\nThis PR adds the link
to the “View related error” / \"View X related\nerrors\" badge in the
full-screen waterfall.\n\nUnlike the same badge in APM, here it’s
handled as a native `href`, so\nthe user keeps the option to open it in
a new tab—avoiding loss of\ncontext from Discover if they prefer.\n\n
**Highlights**\n\n* Created `ApmErrorsContextService` to access the
configured APM error\nindices.\n\n* I had considered merging this with
`TracesContextService` into a\nshared `ApmContextService` (for both
traces and errors), but decided to\nkeep them separate to avoid mixing
methods and logic. Totally open to\nrevisit this if anyone feels that a
shared service would make things\ncleaner or more maintainable.\n\n*
Created `DataSourcesProvider` to easily access the relevant
indices\nwithin our flyouts.\n\n* Built the Discover URL using the
locator, preparing an ESQL query to\nfilter by `span.id` and `trace.id`
across both error and log indices.\n\n* Added `getRelatedErrorsHref` as
a prop to `TraceWaterfallEmbeddable`,\nallowing us to pass the errors
URL directly.\n\n* Why this approach instead of triggering a callback to
the parent? We\nwanted to preserve native link behavior (e.g., open in
new tab), which\nwouldn't work if navigation was handled via
`navigateTo` from the\nparent.\n\n* Created `EmbeddableRelatedErrors` to
handle the badge link.\n\n* Agreed with the EUI team to cast the `href`
as `any`, since due to the\ncomponent nesting in the waterfall, it was
the cleanest way to make the\nnative link behavior work in this
context.\n\n* Created `ExitFullScreenButton` wrapper to enable exiting
full-screen\nmode with the `ESC`
key.\n\n\n\nhttps://github.com/user-attachments/assets/d3e476ae-ee10-410f-b003-02521dc35e13\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Carlos Crespo <crespocarlos@users.noreply.github.com>\nCo-authored-by:
Milosz Marcinkowski
<38698566+miloszmarcinkowski@users.noreply.github.com>","sha":"87cb7685888f21b0f9d2a2467f47701364535b44"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Closes #222591
This PR adds the link to the “View related error” / "View X related errors" badge in the full-screen waterfall.
Unlike the same badge in APM, here it’s handled as a native
href, so the user keeps the option to open it in a new tab—avoiding loss of context from Discover if they prefer.Highlights
Created
ApmErrorsContextServiceto access the configured APM error indices.TracesContextServiceinto a sharedApmContextService(for both traces and errors), but decided to keep them separate to avoid mixing methods and logic. Totally open to revisit this if anyone feels that a shared service would make things cleaner or more maintainable.Created
DataSourcesProviderto easily access the relevant indices within our flyouts.Built the Discover URL using the locator, preparing an ESQL query to filter by
span.idandtrace.idacross both error and log indices.Added
getRelatedErrorsHrefas a prop toTraceWaterfallEmbeddable, allowing us to pass the errors URL directly.navigateTofrom the parent.Created
EmbeddableRelatedErrorsto handle the badge link.hrefasany, since due to the component nesting in the waterfall, it was the cleanest way to make the native link behavior work in this context.Created
ExitFullScreenButtonwrapper to enable exiting full-screen mode with theESCkey.Screen.Recording.2025-06-16.at.10.47.55.mov