-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Synthetics] Fix breadcrumbs in serverless #176947
[Synthetics] Fix breadcrumbs in serverless #176947
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
13e314f
to
7264ac9
Compare
There was a problem hiding this 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.
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
}; | ||
|
||
export const useBreadcrumbs = (extraCrumbs: ChromeBreadcrumb[]) => { | ||
const params = useUrlParams()[0](); | ||
const kibana = useKibana(); | ||
const setBreadcrumbs = kibana.services.chrome?.setBreadcrumbs; | ||
const { setBreadcrumbs, isServerless } = useContext(SyntheticsSettingsContext); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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 !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi 👋 Sorry if you were unnecessarily pinged. 🔔 |
…n. Reference serverless/chrome `setBreadcrumbs` helper based on environment.
3ed490b
to
3c18b20
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
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
orcore.chrome.setBreadcrumbs
function to the props that get propagated to theSyntheticsSettingsContext
. The breadcrumb hooks in the React code will now reference this field, rather than directly pullingchrome.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 itskibana.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:
For maintainers