Skip to content

[APM] Improve user journey from APM UI to Discover while preserving context #232361

Merged
rmyz merged 52 commits intoelastic:mainfrom
rmyz:232178-apm-improve-redirect-discover-waterfall
Sep 1, 2025
Merged

[APM] Improve user journey from APM UI to Discover while preserving context #232361
rmyz merged 52 commits intoelastic:mainfrom
rmyz:232178-apm-improve-redirect-discover-waterfall

Conversation

@rmyz
Copy link
Contributor

@rmyz rmyz commented Aug 20, 2025

Summary

Closes #232178

This PR improves the navigation from APM UI to Discover regarding the traces flow.
When navigating to Discover, the user will be able to see an ES|QL query preserving the context they had in APM UI.

Example of the new logic working:

Kapture.2025-08-27.at.15.19.13.mp4

Modified pages:

  • Service -> transaction group -> trace samples
  • Backend dependency -> Operation -> trace samples
  • Service -> transaction -> latency correlations
  • Service -> transaction -> error correlations
  • Service -> error group -> error samples

Changes made:

  • Added a button to navigate to Discover from APM UI, where there wasn't one before.
  • Moved the "View in Discover" button outside the "Investigate" dropdown for the Waterfall component
  • Reordered the buttons in the Waterfall component and changed "View in Discover" and "View full trace" to use ButtonEmpty.
  • Unified all links to discover in 3 components.
  • Added tests.
Before After
image image

How to test

Important

Please, test both APM and OTel scenarios, so we ensure everything works fine.
Thank you!

APM

  1. Open Kibana
  2. Ingest some data with synthtrace, for example: "many_dependencies", "service_map" or "many_transactions".
  3. Play around with the UIs

OTel

  1. Make sure to run the elastic-stack-docker-compose and uncomment this lines, then run the opentelemetry-demo
  2. Play around with the UIs

@rmyz rmyz self-assigned this Aug 20, 2025
@rmyz
Copy link
Contributor Author

rmyz commented Aug 20, 2025

/ci

@rmyz rmyz added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. Feature:Discover Discover Application apm labels Aug 20, 2025
@rmyz
Copy link
Contributor Author

rmyz commented Aug 20, 2025

/ci

@rmyz rmyz changed the title refactor: improve redirect from apm waterfall to discover [APM] Improve user journey from APM UI to Discover while preserving context Aug 20, 2025
@rmyz
Copy link
Contributor Author

rmyz commented Aug 20, 2025

/ci

@rmyz
Copy link
Contributor Author

rmyz commented Aug 21, 2025

/ci

@rmyz rmyz marked this pull request as ready for review August 21, 2025 10:50
@rmyz rmyz requested a review from a team August 21, 2025 10:50
@rmyz rmyz requested a review from a team as a code owner August 21, 2025 10:50
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@rmyz rmyz requested a review from iblancof August 28, 2025 10:21
Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM

rmyz added 2 commits August 29, 2025 08:42
# Conflicts:
#	x-pack/solutions/observability/plugins/apm/tsconfig.json
@rmyz rmyz requested a review from cauemarcondes August 29, 2025 06:45
Copy link
Contributor

@iblancof iblancof left a comment

Choose a reason for hiding this comment

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

Checked the code changes after the suggested updates, and with "Open in Discover" now everywhere, LGTM

@rmyz rmyz enabled auto-merge (squash) August 29, 2025 11:26
serviceName,
};

const esqlQuery = getESQLQuery({
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 86–115 are duplicated across all three components. Can we refactor it to avoid repetition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was an exact comment asking the opposite, I will keep it in their own components since this PR has been open for too long

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting to do the opposite, It makes sense to keep separate files to handle each case, but in the end we’re always rendering a button that opens Discover with some params. That button logic could be shared.

With the current approach, if we ever need to change how the button works, we’ll have to update it in 3 different components, here as an example

This also makes it easy to introduce inconsistencies, one component is already using a link instead of a button (not sure why).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created base discover button to share the button logic in 84020d1 (#232361)

@rmyz rmyz requested a review from kpatticha September 1, 2025 08:08
@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

History

cc @rmyz

href={discoverHref}
isDisabled={!esqlQuery || indexSettingsStatus !== FETCH_STATUS.SUCCESS}
>
{label}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since the label it the same for all you can consider making it the default

Copy link
Contributor

@kpatticha kpatticha 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, thanks for addressing the comments.

@rmyz rmyz merged commit 481d5f8 into elastic:main Sep 1, 2025
13 checks passed
@rmyz rmyz deleted the 232178-apm-improve-redirect-discover-waterfall branch September 1, 2025 13:56
ymao1 pushed a commit to ymao1/kibana that referenced this pull request Sep 2, 2025
…ontext (elastic#232361)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
MichelLosier pushed a commit to MichelLosier/kibana that referenced this pull request Sep 2, 2025
…ontext (elastic#232361)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kowalczyk-krzysztof pushed a commit to kowalczyk-krzysztof/kibana that referenced this pull request Sep 3, 2025
…ontext (elastic#232361)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm backport:skip This PR does not require backporting Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[APM] Enable user journey from APM UI to Discover while preserving context

7 participants