Skip to content

[Synthetics] Fix breadcrumbs in serverless#176947

Merged
justinkambic merged 16 commits intoelastic:mainfrom
justinkambic:289/fix-breadcrumbs-in-serverless
Mar 5, 2024
Merged

[Synthetics] Fix breadcrumbs in serverless#176947
justinkambic merged 16 commits intoelastic:mainfrom
justinkambic:289/fix-breadcrumbs-in-serverless

Conversation

@justinkambic
Copy link
Copy Markdown
Contributor

Summary

Resolves https://github.com/elastic/synthetics-dev/issues/289.

The Synthetics plugin now consumes the Serverless breadcrumbs API when Kibana is running in Serverless mode.

This patch will re-use all the Synthetics plugin's existing breadcrumb logic, with some minor modifications. At plugin start time, Synthetics will detect if Kibana is stateful or stateless, and either assign the serverless.setBreadcrumbs or core.chrome.setBreadcrumbs function to the props that get propagated to the SyntheticsSettingsContext. The breadcrumb hooks in the React code will now reference this field, rather than directly pulling chrome.setBreadrumbs from the Kibana services object as it did before.

This patch also introduces a new deep link for the Settings page, and adds an associated object to the Observability project nav tree.

One other thing to note is that this patch will also require Synthetics to add the serverless plugin as a dependency in its kibana.json file.

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@ghost
Copy link
Copy Markdown

ghost commented Feb 14, 2024

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

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

@justinkambic justinkambic force-pushed the 289/fix-breadcrumbs-in-serverless branch 2 times, most recently from 13e314f to 7264ac9 Compare February 21, 2024 17:50
@justinkambic justinkambic self-assigned this Feb 21, 2024
@justinkambic justinkambic marked this pull request as ready for review February 21, 2024 17:58
@justinkambic justinkambic requested a review from a team February 21, 2024 17:58
@justinkambic justinkambic requested review from a team as code owners February 21, 2024 17:58
Copy link
Copy Markdown
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

Code review only, deeplinks-observability changes LGTM.

@botelastic botelastic bot added the Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. label Feb 22, 2024
@elasticmachine
Copy link
Copy Markdown
Contributor

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

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.

@crespocarlos I liked what @justinkambic is doing here. He's abstracting the setBreadcrumbs during kibana start to be either serverless or stateful kibana.

Clients don't care where they are, they just know how to add its value to the breadcrumbs.

I see the exact same code being written in different ways all over our plugins. Maybe this is a good thing to export to a common place.

Copy link
Copy Markdown
Contributor

@crespocarlos crespocarlos Feb 22, 2024

Choose a reason for hiding this comment

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

Yeah, this is very nice and more interesting than the other approaches I saw in the codebase.

At first, I thought about following a similar path, but I didn't want to change the useBreadcrumbs in the observabilty_shared at this moment.

Especially because by doing that, we're overriding the default serverless breadcrumbs feature, which observes the navigation tree config in the serverless-* plugins and sets the breadcrumbs automatically. If we do the same in the observability_shared we need to make sure everything that depends on it still works as expected

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.

In the case of Synthetics there is a good deal of custom-rolled breadcrumb logic and my motivation was to avoid touching that as much as possible.

This was nice because the API is very similar between chrome.setBreadcrumbs and the Serverless plugin's version; in the case of Synthetics it was a simple drop-in replacement.

Copy link
Copy Markdown
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

Obs UX Changes LGTM !!

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

@justinkambic justinkambic added the release_note:skip Skip the PR/issue when compiling release notes label Feb 22, 2024
@justinkambic justinkambic enabled auto-merge (squash) February 22, 2024 15:32
@justinkambic justinkambic requested review from a team as code owners February 23, 2024 21:09
@justinkambic justinkambic removed request for a team February 23, 2024 21:10
@justinkambic
Copy link
Copy Markdown
Contributor Author

Hi 👋 Sorry if you were unnecessarily pinged. 🔔

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
synthetics 844.3KB 844.5KB +201.0B

Page load bundle

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

id before after diff
serverlessObservability 26.4KB 26.6KB +195.0B
synthetics 19.7KB 19.7KB +42.0B
total +237.0B

History

  • 💔 Build #195368 failed 3ed490b542733578d46940a797fa3e728e8fb583
  • 💔 Build #195117 failed 2442dadd670ae5f9a05c4454e02dfdcbfdb1c004
  • 💔 Build #195098 failed 2dba34e4d13ec6a407eb7801000fdc4d6c0ec8b3
  • 💔 Build #195015 failed e62ffa4d002b3719600e29cdb0a3484c5721e3c1

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

cc @justinkambic

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 release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v8.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants