Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Logs+] Add Log Explorer profile deep link #161939

Merged
merged 47 commits into from
Jul 24, 2023

Conversation

tonyghiani
Copy link
Contributor

@tonyghiani tonyghiani commented Jul 14, 2023

📓 Summary

closes #161748

The implementation registers an app updater on the discover-log-explorer plugin to update the deep link list.

The deep link is accessible using the discover:log-explorer link.

Screenshot 2023-07-14 at 18 39 02

@tonyghiani tonyghiani added Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes labels Jul 14, 2023
@tonyghiani tonyghiani requested review from a team as code owners July 14, 2023 10:04
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@weltenwort weltenwort self-requested a review July 14, 2023 10:11
Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

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

Seems to work well 👍 I just left a question about the code organization below.

export type DeepLinkId = AppId;
export type AppId = DiscoverApp | DashboardApp | VisualizeApp;

export type DiscoverAppProfile = 'log-explorer';
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to keep the knowledge about the existence of the specific profile confined to the discover_log_explorer plugin? Why would it have to live here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the work done for using the deep link ids instead of the href, setting this type as part of the DeepLinkId union will allow accessing this deep link when it'll be referenced on the Observability serverless project navigation sidebar.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see. Would it make sense to move it to the observability deep links package, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do it, I added this in the analytics package since the whole definition for discover was there, but make sense to have it in the obs package.

@tonyghiani tonyghiani requested a review from a team as a code owner July 14, 2023 11:06
@@ -27,6 +27,8 @@ export type AppId =
| ApmApp
| MetricsApp;

export type DiscoverLogExplorerId = 'discover:log-explorer';
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for being so picky 😇 would it make sense to still interpolate DISCOVER_APP_ID here?

@tonyghiani tonyghiani removed request for a team July 14, 2023 13:20
@isaclfreire
Copy link

Great work, nice to see we're already tackling this!

Just a few small notes to address if possible:

  • consider having the o11y logo in the left
  • consider having 'Observability' instead of Analytics
  • we're missing an S in the name, if I'm not mistaken it should be Logs Explorer
Screenshot 2023-07-14 at 18 02 51

@tonyghiani tonyghiani requested review from a team as code owners July 14, 2023 16:35
@tonyghiani
Copy link
Contributor Author

Hey @isaclfreire, thanks for the review, I just pushed a change that allows us to customize the deep link with our preferred category (before, it was always using the parent app, in this case, Discover), I think it now looks as expected:

Screenshot 2023-07-14 at 18 39 02

@tonyghiani
Copy link
Contributor Author

I think I understand what you mean. The change in behaviour of the application service you propose might have an impact on many Kibana plugins, though.

Apparently, it didn't break anything (the failing tests were caused by the appUpdater not executing and updating correctly the state because the first emitted updater function was overridden by the contributeState$ one, but your suggestion combining the states fix it).
You are probably right that it still affects the behaviour of many plugins and could have some side effects we wouldn't detect if not tested properly, I switched it back to how it was before.

Might be a workable solution if the Kibana core team would rather not change the core behaviour. What do you think?

Totally, I didn't think about combining them, doing so we get the expected behaviour back, thanks for the suggestion!

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

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

LGTM, very nicely done 👏

customizationCallbacks: [callback, callback2],
deepLinks: [],
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a test to ensure the deep links are emitted correctly by the appupdater?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I added a test for the registry behaviour and also a functional test as part of the customizations functional tests.
I'll make sure to also bring them into the serverless test suite in the follow-up work for [Log Explorer] Missing test suite for DatasetSelector in log-explorer profile#160627

Copy link
Member

Choose a reason for hiding this comment

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

thank you!

Comment on lines 31 to 34
map((profilesList) => {
const mergedDeepLinks = profilesList.flatMap((profile) => profile.deepLinks ?? []);
return getUniqueDeepLinks(mergedDeepLinks);
}),
Copy link
Member

Choose a reason for hiding this comment

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

Since we're applying getUniqueDeepLinks in the next map too, do we want to skip this duplicate call?

Suggested change
map((profilesList) => {
const mergedDeepLinks = profilesList.flatMap((profile) => profile.deepLinks ?? []);
return getUniqueDeepLinks(mergedDeepLinks);
}),
map((profilesList) => profilesList.flatMap((profile) => profile.deepLinks ?? [])),

@@ -37,9 +37,11 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {

// TODO: test something oblt project specific instead of generic discover
Copy link
Member

Choose a reason for hiding this comment

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

Can we consider this TODO to be completed?

@@ -79,11 +81,11 @@ export default function ({ getPageObject, getService }: FtrProviderContext) {
it('navigate using search', async () => {
await svlCommonNavigation.search.showSearch();
// TODO: test something oblt project specific instead of generic discover
Copy link
Member

Choose a reason for hiding this comment

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

Can we consider this TODO to be completed?

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

Discover changes LGTM! 👍 I left a couple of very minor comments, but otherwise this approach makes sense to me. I followed the appUpdater conversation and agree with moving the deep link logic to the customization profiles. I also appreciate that the Discover changes to make it function were fairly minimal.

I'm approving now since the code changes all look good to me, but it would be great if you could address my last couple of comments before merging.

@weltenwort
Copy link
Member

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discoverLogExplorer 149 150 +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
discover 71 79 +8

Async chunks

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

id before after diff
discover 539.6KB 539.6KB -8.0B
discoverLogExplorer 197.9KB 197.8KB -33.0B
total -41.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 29.4KB 30.1KB +706.0B
discoverLogExplorer 4.5KB 5.2KB +683.0B
globalSearchProviders 4.6KB 4.8KB +199.0B
serverlessObservability 26.1KB 26.2KB +110.0B
total +1.7KB
Unknown metric groups

API count

id before after diff
discover 97 105 +8

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@weltenwort
Copy link
Member

Thanks for the repeated review, @davismcphee 🙏 I've applied your suggestions (except for the locator usage as explained in my response).

@weltenwort weltenwort merged commit 9bae853 into elastic:main Jul 24, 2023
20 checks passed
@kibanamachine kibanamachine added v8.10.0 backport:skip This commit does not require backporting labels Jul 24, 2023
@tonyghiani tonyghiani deleted the 161748-log-explorer-deeplink branch July 28, 2023 07:12
ThomThomson pushed a commit to ThomThomson/kibana that referenced this pull request Aug 1, 2023
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: weltenwort <stuermer@weltenwort.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Log Explorer] Add deep navigation link