Skip to content

[Discover][Traces] All "Open in Discover" links now open in a new Discover Tab on left-click#251103

Merged
iblancof merged 46 commits intoelastic:mainfrom
iblancof:4863-deliverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
Feb 4, 2026
Merged

[Discover][Traces] All "Open in Discover" links now open in a new Discover Tab on left-click#251103
iblancof merged 46 commits intoelastic:mainfrom
iblancof:4863-deliverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab

Conversation

@iblancof
Copy link
Copy Markdown
Contributor

@iblancof iblancof commented Jan 30, 2026

Summary

Closes #241280

Now that we have Discover Tabs, all links from Discover within Discover should open in a new tab.
This PR updates all the "Open in Discover" buttons to follow that pattern, as decided by the product team.

  • On left-click: it will open a new Discover tab.
  • On right-click: users can select to 'open new tab' in their browser.

Span/Transaction flyout

Section Interaction
Similar spans similar_spans_f_waterfall
Trace TODO, pending on #249632 to be mergedScreen Recording 2026-02-03 at 10 50 15
Errors errors
Logs logs
Span Links span_links

ℹ️ Updated data-test-subj for Span Links and Errors sections, which were duplicated and wrong.

Log flyout

Section Interaction
Similar errors similar_errors

@iblancof iblancof self-assigned this Jan 30, 2026
@iblancof iblancof requested review from a team as code owners January 30, 2026 15:59
@iblancof iblancof added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Project:OneDiscover Enrich Discover with contextual awareness labels Jan 30, 2026
Comment on lines +34 to +39
if (canOpenInNewTab) {
openInNewTab({
query: { esql },
tabLabel,
});
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could do like this if you want to:

Suggested change
if (canOpenInNewTab) {
openInNewTab({
query: { esql },
tabLabel,
});
}
actions?.openInNewTab?.(
query: { esql },
tabLabel
});

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.

The condition checks for esql too, as it needs to be defined to run the action.
That’s why I’m using canOpenInNewTab (also used later in the code), which ensures both openInNewTab and esql are defined

Copy link
Copy Markdown
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Data Discovery changes look good overall, just a small request to adjust the types a bit.

Comment on lines +46 to +53
export interface DocViewActions {
openInNewTab?: (params: {
query?: Query | AggregateQuery;
tabLabel?: string;
timeRange?: TimeRange;
}) => void;
updateESQLQuery?: (queryOrUpdater: string | ((prevQuery: string) => string)) => void;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These actions are too Discover specific to add on all doc views. Can we instead make doc views that want to use them extend a common props interface with actions?: DocViewActions; to make it opt in?

Also unfortunate we need to duplicate types from Discover, but that's more an issue on our end. We originally assumed contextual components would live directly in the Discover codebase.

Copy link
Copy Markdown
Contributor Author

@iblancof iblancof Feb 3, 2026

Choose a reason for hiding this comment

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

Hey Davis, thanks so much for the feedback.

These actions are too Discover specific to add on all doc views. Can we instead make doc views that want to use them extend a common props interface with actions?: DocViewActions; to make it opt in?

I actually had the same question initially when adding actions directly to DocViewRenderProps, but I decided to include it after seeing that filters, onAddColumn, and onRemoveColumn were already defined there, and those also feel quite tightly coupled to Discover. Are those functions meant to be used outside of Discover as well? Maybe I’m missing some context here.

That said, I’ll follow your recommendation since you suggested it, but I’d still love to better understand what makes actions different from the other functions I mentioned above.

Also unfortunate we need to duplicate types from Discover, but that's more an issue on our end. We originally assumed contextual components would live directly in the Discover codebase.

Yeah, I did run into circular deps at some point because of types. We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for updating it!

Are those functions meant to be used outside of Discover as well?

While it's not the way I'd model it personally tbh, yes they can be. They're for integrating with any consumers supporting Unified Search or displaying tabular results (e.g. Timeline, Streams, etc.). Also worth noting Unified Doc Viewer is quite old and carries around some unfortunate tech debt.

We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.

I think extracting them is probably an acceptable solution, it just hadn't been an issue until more recently so we never did. I'm also ok with components living outside the Discover codebase, just an incorrect assumption when we first built things.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general we're adding more and more Discover specific code like these hooks to the Unified Doc Viewer plugin, but it's really intended to be generic. Not an ask for this PR of course, but I think we should discuss migrating contextual components to the @kbn/discover-contextual-components package.

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.

Yeah, we’re adding quite a bit of Discover specific functionality right now, mainly because that’s where we're using it the most at the moment. I also understand that unified_doc_viewer is meant to be reused in other areas (probably APM for us in the future), similar to what the logs embeddable is doing, am I right?

It might be helpful to clarify some guidelines around this, since having things like filter, onAddColumn, or onRemoveColumn can be a bit confusing when trying to keep the architectural structure you’re aiming for in mind.

I’d be happy to have a conversation about this, and if moving things to @kbn/discover-contextual-components makes sense, I think doing it sooner rather than later would help us get the most out of it while keeping a clean structure.

Would One Discover sync be the right place for this, especially considering Security might start adding things on their side soon?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, Unified Doc Viewer is used in a few different places currently. Streams, ES|QL grid, synthetics, etc., but Discover is the main one. Similar to the embeddable, but also our other shared components like Unified Data Table and Unified Field List.

I don't think we need to be too worried about the other props though and can still treat the Discover actions differently. I'm also in part pushing for this approach because I'd like to unify extension point actions handling, and this way simplifies that later.

Definitely up to chat more about moving things to @kbn/discover-contextual-components though, and agreed sooner is better. Been meaning to for a while tbh, and One Discover would be the place to do it!

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #102 / Serverless Common UI - Management Data View Management creating and deleting default data view "before all" hook in "creating and deleting default data view"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
unifiedDocViewer 799 802 +3

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 +109.0B
unifiedDocViewer 382.6KB 383.6KB +1.0KB
total +1.1KB

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-doc-viewer 4 5 +1
Unknown metric groups

References to deprecated APIs

id before after diff
unifiedDocViewer 28 36 +8

Unreferenced deprecated APIs

id before after diff
unifiedDocViewer 28 36 +8

History

cc @iblancof

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor

@davismcphee davismcphee 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 the updates! Tested the trace overview locally and it works well, LGTM 👍

Comment on lines +46 to +53
export interface DocViewActions {
openInNewTab?: (params: {
query?: Query | AggregateQuery;
tabLabel?: string;
timeRange?: TimeRange;
}) => void;
updateESQLQuery?: (queryOrUpdater: string | ((prevQuery: string) => string)) => void;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for updating it!

Are those functions meant to be used outside of Discover as well?

While it's not the way I'd model it personally tbh, yes they can be. They're for integrating with any consumers supporting Unified Search or displaying tabular results (e.g. Timeline, Streams, etc.). Also worth noting Unified Doc Viewer is quite old and carries around some unfortunate tech debt.

We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.

I think extracting them is probably an acceptable solution, it just hadn't been an issue until more recently so we never did. I'm also ok with components living outside the Discover codebase, just an incorrect assumption when we first built things.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, Unified Doc Viewer is used in a few different places currently. Streams, ES|QL grid, synthetics, etc., but Discover is the main one. Similar to the embeddable, but also our other shared components like Unified Data Table and Unified Field List.

I don't think we need to be too worried about the other props though and can still treat the Discover actions differently. I'm also in part pushing for this approach because I'd like to unify extension point actions handling, and this way simplifies that later.

Definitely up to chat more about moving things to @kbn/discover-contextual-components though, and agreed sooner is better. Been meaning to for a while tbh, and One Discover would be the place to do it!

@iblancof iblancof merged commit edc360d into elastic:main Feb 4, 2026
16 checks passed
iblancof added a commit that referenced this pull request Feb 9, 2026
…n in new Discover tabs (#251879)

## Summary

Relates to #241280
Closes #251104

With the recent addition of Discover Tabs, we wanted to update all links
in the Overview tab that open Discover queries so that they now open in
a new Discover tab on left-click, instead of reloading Discover,
providing a more seamless experience.

This work was split into two parts:

- “Open in Discover” links in all sections
   - #251103
- Links to specific documents or contexts (handled in this PR)

Some of the links in this PR may eventually open the details in a child
flyout. However, to maintain a consistent pattern for all links pointing
to Discover, we decided to migrate them all now, even if their behavior
will change in the future.




|Section|Behaviour|
|-|-|

|Errors|![errors_table](https://github.com/user-attachments/assets/eb755346-bc85-4421-bc86-43e239864427)|
|Span
links|![span_links](https://github.com/user-attachments/assets/3787c791-996e-40bc-899c-46993b756cc2)|

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Dosant pushed a commit to Dosant/kibana that referenced this pull request Feb 9, 2026
…n in new Discover tabs (elastic#251879)

## Summary

Relates to elastic#241280
Closes elastic#251104

With the recent addition of Discover Tabs, we wanted to update all links
in the Overview tab that open Discover queries so that they now open in
a new Discover tab on left-click, instead of reloading Discover,
providing a more seamless experience.

This work was split into two parts:

- “Open in Discover” links in all sections
   - elastic#251103
- Links to specific documents or contexts (handled in this PR)

Some of the links in this PR may eventually open the details in a child
flyout. However, to maintain a consistent pattern for all links pointing
to Discover, we decided to migrate them all now, even if their behavior
will change in the future.




|Section|Behaviour|
|-|-|

|Errors|![errors_table](https://github.com/user-attachments/assets/eb755346-bc85-4421-bc86-43e239864427)|
|Span
links|![span_links](https://github.com/user-attachments/assets/3787c791-996e-40bc-899c-46993b756cc2)|

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@iblancof iblancof deleted the 4863-deliverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab branch March 13, 2026 10:01
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:Traces in Discover Project:OneDiscover Enrich Discover with contextual awareness release_note:skip Skip the PR/issue when compiling release notes Team:obs-exploration Observability Exploration team v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover][Traces] "Open in Discover" Overview links now open in a new Discover Tab

5 participants