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

Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag #204547

Merged

Conversation

maryam-saeidi
Copy link
Member

@maryam-saeidi maryam-saeidi commented Dec 17, 2024

Resolves #195778

🐞 Summary

This PR fixes missing executionContext in sharedux router by adding SharedUXContext to the KibanaRootContextProvider (inside of the KibanaRenderContextProvider). (More context provided in this #195778 (comment))

It also introduces enableExecutionContextTracking to enable tracking logic to avoid creating a race condition for the existing custom execution context tracking implementations.

I enabled this flag for the observability plugin and here is the difference:

Item Screenshot
Before image
After image

🧪 How to test

  • Go to the observability alerts page and check the kibana-browser request as shown above

✨ Possible future improvements

Allowing this logic to be provided by the consumer so that we can get rid of custom implementations (Example: APM custom execution context)

@maryam-saeidi maryam-saeidi added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Dec 17, 2024
@maryam-saeidi maryam-saeidi self-assigned this Dec 17, 2024
@maryam-saeidi maryam-saeidi requested review from a team as code owners December 17, 2024 11:16
@botelastic botelastic bot added the Team:obs-ux-management Observability Management User Experience Team label Dec 17, 2024
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Looks good!

I also suggest to change MatchPropagator so that it throws error if executionContext is undefined. We can do this now because MatchPropagator should only be called when consumer set enableExecutionContextTracking to true. This would help us find missconfiguration errors like we had today where executionContext became undefined

@@ -63,12 +63,12 @@ const defaultContextValue = {
services: {},
};

export const sharedUXContext =
export const SharedUXContext =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please rename this into SharedUXRouterContext

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed in c56ab90

path={path}
element={
<>
{enableExecutionContextTracking && <MatchPropagator />}
Copy link
Contributor

@Dosant Dosant Dec 17, 2024

Choose a reason for hiding this comment

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

do we need this here? Seems like this will also be called inside <Route/> component

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so, but I am not sure how to verify that. Would you mind checking it? If you and your team don't see a use case for it, I can remove it, but I am not sure why it was added in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I double-checked. Agree that we should keep it here

Copy link
Member

@jasonrhodes jasonrhodes left a comment

Choose a reason for hiding this comment

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

Approving bc this seems to work, I left a comment just to understand better.

@@ -28,7 +28,7 @@ import { HideableReactQueryDevTools } from './hideable_react_query_dev_tools';
function App() {
return (
<>
<Routes>
<Routes enableExecutionContextTracking={true}>
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain a little more about why we have to explicitly opt into this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I started by enabling this logic everywhere in this PR, assuming any custom implementation will override it. But when I asked teams to verify this assumption, in some cases, that was not the case, and when Anton and I were checking the issue, it seemed there could be a race condition, and we cannot rely on the order of execution here.

So, I decided to disable this logic where we have custom implementation and have it out of the box everywhere else, but due to the following reasons, I decided to change direction:

  1. For security, there are many places where we need to disable default tracking, which didn't seem to be worth it.
  2. We cannot ensure in places that we enable it, it works as expected. So, allowing each team to enable it to verify the changes seemed like a better approach.
  3. PR review in case of disabling would take a lot of time since different teams need to check the existing implementation for all their routes in one PR.

@maryam-saeidi
Copy link
Member Author

@Dosant Thanks for your feedback; as discussed offline, I add the code to throw an error in case executionContext is not available, and we are in dev mode: 53a7e9a

@maryam-saeidi maryam-saeidi requested a review from Dosant December 18, 2024 10:25
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #65 / serverless observability UI Observability Logs Explorer DataSourceSelector with installed integrations and uncategorized data streams "after all" hook in "with installed integrations and uncategorized data streams"
  • [job] [logs] FTR Configs #65 / serverless observability UI Observability Logs Explorer DataSourceSelector with installed integrations and uncategorized data streams "before all" hook in "with installed integrations and uncategorized data streams"
  • [job] [logs] FTR Configs #101 / serverless search UI Serverless Inference Management UI delete action "before each" hook for "deletes modal successfully with usage"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
advancedSettings 111 122 +11
aiAssistantManagementSelection 75 76 +1
aiops 623 630 +7
alerting 246 247 +1
apm 1923 1924 +1
assetInventory 16 17 +1
banners 34 45 +11
canvas 1292 1293 +1
cases 827 828 +1
cloudDataMigration 23 34 +11
cloudDefend 104 105 +1
cloudLinks 79 90 +11
cloudSecurityPosture 660 661 +1
console 236 237 +1
controls 368 379 +11
core 421 422 +1
crossClusterReplication 134 135 +1
dashboard 693 694 +1
dashboardEnhanced 98 109 +11
data 523 534 +11
dataQuality 91 92 +1
dataUsage 143 144 +1
dataViewEditor 87 98 +11
dataViewFieldEditor 163 174 +11
dataViewManagement 249 250 +1
dataVisualizer 736 743 +7
devTools 44 45 +1
discover 945 946 +1
embeddable 133 144 +11
enterpriseSearch 2309 2310 +1
entityManagerApp 45 46 +1
eventAnnotationListing 629 637 +8
exploratoryView 183 184 +1
expressionGauge 108 119 +11
expressionHeatmap 220 231 +11
expressionLegacyMetricVis 48 59 +11
expressionMetricVis 153 164 +11
expressionPartitionVis 237 248 +11
expressionTagcloud 208 219 +11
expressionXY 298 309 +11
filesManagement 199 200 +1
fleet 1252 1253 +1
globalSearchBar 49 58 +9
graph 311 312 +1
grokdebugger 42 53 +11
guidedOnboarding 43 54 +11
home 268 269 +1
imageEmbeddable 143 154 +11
indexLifecycleManagement 263 264 +1
indexManagement 697 698 +1
infra 1543 1544 +1
ingestPipelines 357 358 +1
inputControlVis 96 107 +11
inspector 79 90 +11
integrationAssistant 474 475 +1
interactiveSetup 59 70 +11
inventory 258 259 +1
investigateApp 589 590 +1
kibanaOverview 138 139 +1
kibanaReact 212 219 +7
kubernetesSecurity 210 211 +1
lens 1555 1556 +1
licenseManagement 126 127 +1
licensing 30 41 +11
links 133 144 +11
logstash 76 77 +1
management 131 132 +1
maps 1264 1265 +1
metricsDataAccess 294 305 +11
ml 2138 2139 +1
mockIdpPlugin 36 47 +11
monitoring 500 501 +1
navigation 78 89 +11
newsfeed 28 39 +11
observability 1109 1110 +1
observabilityAIAssistantApp 422 423 +1
observabilityAiAssistantManagement 367 368 +1
observabilityLogsExplorer 212 213 +1
observabilityOnboarding 256 257 +1
osquery 346 347 +1
painlessLab 46 57 +11
presentationPanel 113 124 +11
profiling 313 314 +1
remoteClusters 126 127 +1
reporting 154 165 +11
rollup 147 148 +1
runtimeFields 35 46 +11
savedObjects 37 48 +11
savedObjectsManagement 123 124 +1
savedObjectsTagging 107 118 +11
searchHomepage 153 154 +1
searchIndices 238 239 +1
searchInferenceEndpoints 162 163 +1
searchPlayground 270 271 +1
searchprofiler 80 91 +11
security 528 529 +1
securitySolution 6434 6435 +1
serverless 79 90 +11
serverlessSearch 305 306 +1
share 92 103 +11
slo 862 863 +1
snapshotRestore 212 213 +1
spaces 339 340 +1
streamsApp 168 169 +1
synthetics 1043 1044 +1
telemetry 55 66 +11
timelines 176 187 +11
transform 489 490 +1
triggersActionsUi 869 870 +1
uiActions 41 52 +11
unifiedSearch 377 386 +9
upgradeAssistant 170 171 +1
uptime 591 592 +1
ux 206 207 +1
visDefaultEditor 244 255 +11
visTypeMarkdown 33 44 +11
visTypeTable 51 62 +11
visTypeTimelion 67 78 +11
visTypeTimeseries 500 509 +9
visTypeVega 331 342 +11
visTypeVislib 127 138 +11
visualizations 492 493 +1
watcher 190 191 +1
total +642

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
@kbn/shared-ux-router 13 15 +2

Async chunks

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

id before after diff
aiops 621.5KB 622.1KB +648.0B
alerting 100.3KB 100.7KB +399.0B
apm 3.3MB 3.3MB +373.0B
canvas 1.1MB 1.1MB +551.0B
cases 491.2KB 491.4KB +235.0B
cloudDataMigration 6.4KB 6.6KB +162.0B
cloudDefend 101.2KB 101.5KB +286.0B
cloudSecurityPosture 503.0KB 503.4KB +392.0B
console 206.9KB 207.1KB +237.0B
controls 494.5KB 494.7KB +163.0B
crossClusterReplication 146.9KB 147.5KB +583.0B
dashboard 667.7KB 668.0KB +252.0B
dataQuality 28.8KB 29.2KB +401.0B
dataUsage 243.3KB 243.7KB +420.0B
dataViewFieldEditor 178.3KB 178.3KB +1.0B
dataViewManagement 140.5KB 140.8KB +391.0B
dataVisualizer 616.4KB 617.1KB +810.0B
devTools 8.3KB 8.7KB +387.0B
discover 786.1KB 786.7KB +545.0B
enterpriseSearch 2.6MB 2.6MB +588.0B
entityManagerApp 12.3KB 12.5KB +167.0B
eventAnnotationListing 232.0KB 232.2KB +167.0B
exploratoryView 183.5KB 184.0KB +543.0B
filesManagement 125.8KB 126.0KB +216.0B
fleet 1.7MB 1.7MB +770.0B
graph 418.4KB 418.7KB +401.0B
grokdebugger 11.5KB 11.7KB +163.0B
home 152.5KB 153.0KB +517.0B
imageEmbeddable 70.2KB 70.5KB +324.0B
indexLifecycleManagement 166.4KB 166.8KB +403.0B
indexManagement 699.4KB 699.6KB +239.0B
infra 1.7MB 1.7MB +1011.0B
ingestPipelines 406.9KB 407.1KB +236.0B
inputControlVis 52.6KB 52.8KB +162.0B
integrationAssistant 880.5KB 880.8KB +284.0B
inventory 234.4KB 234.6KB +167.0B
investigateApp 482.5KB 482.8KB +286.0B
kibanaOverview 55.2KB 55.6KB +403.0B
kibanaReact 197.2KB 197.2KB +3.0B
kubernetesSecurity 259.3KB 259.5KB +290.0B
lens 1.5MB 1.5MB +557.0B
licenseManagement 47.1KB 47.5KB +405.0B
links 48.6KB 48.8KB +162.0B
logstash 34.0KB 34.3KB +391.0B
management 48.8KB 49.2KB +404.0B
maps 3.0MB 3.0MB +274.0B
metricsDataAccess 100.0KB 100.2KB +162.0B
ml 4.7MB 4.7MB +3.0KB
monitoring 538.5KB 538.9KB +407.0B
observability 480.8KB 481.1KB +267.0B
observabilityLogsExplorer 148.1KB 148.6KB +545.0B
observabilityOnboarding 273.4KB 273.8KB +403.0B
osquery 1.0MB 1.0MB +248.0B
painlessLab 19.1KB 19.3KB +166.0B
profiling 406.7KB 406.9KB +171.0B
remoteClusters 79.8KB 80.2KB +406.0B
rollup 116.1KB 116.5KB +405.0B
savedObjectsManagement 87.3KB 87.7KB +387.0B
searchHomepage 55.4KB 55.9KB +540.0B
searchIndices 169.5KB 170.3KB +744.0B
searchInferenceEndpoints 99.1KB 99.7KB +548.0B
searchPlayground 164.6KB 165.1KB +547.0B
searchprofiler 49.4KB 49.5KB +166.0B
security 541.4KB 541.4KB +6.0B
securitySolution 21.4MB 21.4MB +2.9KB
serverlessSearch 369.7KB 371.7KB +2.0KB
slo 851.1KB 852.6KB +1.5KB
snapshotRestore 263.6KB 264.1KB +448.0B
spaces 256.9KB 256.9KB +1.0B
streamsApp 116.8KB 116.9KB +167.0B
synthetics 1.1MB 1.1MB +861.0B
timelines 33.3KB 33.4KB +162.0B
transform 476.2KB 476.8KB +550.0B
triggersActionsUi 1.7MB 1.7MB +4.5KB
unifiedSearch 363.5KB 363.5KB +2.0B
upgradeAssistant 158.6KB 158.8KB +240.0B
uptime 466.9KB 467.4KB +544.0B
ux 168.1KB 168.2KB +166.0B
visTypeTimeseries 507.3KB 507.3KB +4.0B
visTypeVega 1.9MB 1.9MB +2.0B
visualizations 321.9KB 322.2KB +240.0B
watcher 166.9KB 167.4KB +476.0B
total +39.9KB

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/shared-ux-router 0 2 +2

Page load bundle

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

id before after diff
advancedSettings 8.0KB 8.2KB +162.0B
banners 11.0KB 11.2KB +162.0B
cases 160.0KB 160.3KB +309.0B
cloudLinks 30.8KB 31.0KB +167.0B
console 38.7KB 39.0KB +308.0B
core 447.0KB 447.4KB +395.0B
dashboard 52.2KB 52.5KB +308.0B
dashboardEnhanced 18.5KB 18.7KB +168.0B
data 420.9KB 421.1KB +163.0B
dataViewEditor 14.1KB 14.3KB +162.0B
dataViewFieldEditor 27.4KB 27.5KB +163.0B
embeddable 55.9KB 56.1KB +166.0B
expressionGauge 16.9KB 17.0KB +162.0B
expressionHeatmap 17.8KB 17.9KB +162.0B
expressionLegacyMetricVis 13.1KB 13.2KB +162.0B
expressionMetricVis 17.4KB 17.6KB +162.0B
expressionPartitionVis 29.7KB 29.9KB +162.0B
expressionTagcloud 13.8KB 14.0KB +162.0B
expressionXY 42.6KB 42.8KB +166.0B
fleet 173.9KB 174.2KB +309.0B
globalSearchBar 30.4KB 30.6KB +169.0B
guidedOnboarding 30.2KB 30.4KB +166.0B
indexManagement 47.3KB 47.6KB +308.0B
ingestPipelines 18.1KB 18.4KB +308.0B
inspector 25.5KB 25.7KB +162.0B
interactiveSetup 60.3KB 60.5KB +171.0B
kbnUiSharedDeps-srcJs 3.5MB 3.5MB +1.0B
kibanaReact 39.8KB 40.0KB +175.0B
licensing 12.3KB 12.4KB +162.0B
maps 54.8KB 55.1KB +308.0B
mockIdpPlugin 10.4KB 10.6KB +162.0B
navigation 18.3KB 18.3KB +3.0B
newsfeed 13.3KB 13.5KB +162.0B
observability 104.9KB 105.2KB +309.0B
osquery 47.5KB 47.8KB +308.0B
presentationPanel 43.8KB 44.0KB +162.0B
reporting 50.9KB 51.1KB +162.0B
runtimeFields 14.4KB 14.6KB +162.0B
savedObjects 18.1KB 18.3KB +162.0B
savedObjectsTagging 23.2KB 23.3KB +162.0B
security 68.4KB 69.1KB +685.0B
serverless 15.0KB 15.1KB +164.0B
share 58.2KB 58.3KB +168.0B
spaces 34.9KB 35.4KB +541.0B
telemetry 25.4KB 25.6KB +168.0B
uiActions 24.6KB 24.7KB +169.0B
unifiedSearch 38.8KB 38.9KB +162.0B
upgradeAssistant 25.1KB 25.4KB +308.0B
visDefaultEditor 24.6KB 24.7KB +162.0B
visTypeMarkdown 10.3KB 10.4KB +162.0B
visTypeTable 19.8KB 19.9KB +162.0B
visTypeTimelion 14.1KB 14.2KB +162.0B
visTypeTimeseries 21.0KB 21.2KB +163.0B
visTypeVega 45.6KB 45.7KB +167.0B
visTypeVislib 15.6KB 15.8KB +162.0B
visualizations 65.3KB 65.6KB +308.0B
total +11.3KB
Unknown metric groups

API count

id before after diff
@kbn/react-kibana-context-root 11 12 +1
@kbn/shared-ux-router 14 16 +2
total +3

History

cc @maryam-saeidi

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

lgtm, thank you!

@maryam-saeidi maryam-saeidi merged commit 53748fd into elastic:main Dec 18, 2024
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12393464758

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [DOCS] Link to Playground videos (#204716)
- Fix/renovate pipeline (#204672)
- [Cloud Security] Move @kbn/cloud-security-posture-storybook-config for Kibana sustainability (#204500)
- [AI Connector] Change completion subAction schema to be OpenAI compatible (#200249)
- [Security Solution][SIEM migrations] Onboarding UI improvements (#204320)

Manual backport

To create the backport manually run:

node scripts/backport --pr 204547

Questions ?

Please refer to the Backport tool documentation

@maryam-saeidi
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maryam-saeidi added a commit to maryam-saeidi/kibana that referenced this pull request Dec 18, 2024
…eExecutionContextTracking flag (elastic#204547)

Resolves elastic#195778

## 🐞 Summary
This PR fixes missing executionContext in sharedux router by adding
`SharedUXContext` to the `KibanaRootContextProvider` (inside of the
`KibanaRenderContextProvider`). (More context provided in this
elastic#195778 (comment))

It also introduces `enableExecutionContextTracking` to enable tracking
logic to avoid creating a race condition for the existing custom
execution context tracking implementations.

I enabled this flag for the observability plugin and here is the
difference:

|Item|Screenshot|
|---|---|

|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|

|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|

### 🧪 How to test
- Go to the observability alerts page and check the kibana-browser
request as shown above

### ✨ Possible future improvements

Allowing this logic to be provided by the consumer so that we can get
rid of custom implementations (Example: [APM custom execution
context](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))

---------

Co-authored-by: Anton Dosov <[email protected]>
Co-authored-by: Davis McPhee <[email protected]>
Co-authored-by: Marco Antonio Ghiani <[email protected]>
Co-authored-by: Elena Stoeva <[email protected]>
(cherry picked from commit 53748fd)

# Conflicts:
#	packages/react/kibana_context/root/BUILD.bazel
@maryam-saeidi maryam-saeidi deleted the 195778-fix-pageName-second-try branch December 18, 2024 16:29
@maryam-saeidi maryam-saeidi added the backport:version Backport to applied version labels label Dec 18, 2024
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.17, 8.x

https://github.com/elastic/kibana/actions/runs/12397221444

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.17 Backport failed because of merge conflicts
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [Security Solution][SIEM migrations] Onboarding UI improvements (#204320)

Manual backport

To create the backport manually run:

node scripts/backport --pr 204547

Questions ?

Please refer to the Backport tool documentation

maryam-saeidi added a commit to maryam-saeidi/kibana that referenced this pull request Dec 18, 2024
…eExecutionContextTracking flag (elastic#204547)

Resolves elastic#195778

## 🐞 Summary
This PR fixes missing executionContext in sharedux router by adding
`SharedUXContext` to the `KibanaRootContextProvider` (inside of the
`KibanaRenderContextProvider`). (More context provided in this
elastic#195778 (comment))

It also introduces `enableExecutionContextTracking` to enable tracking
logic to avoid creating a race condition for the existing custom
execution context tracking implementations.

I enabled this flag for the observability plugin and here is the
difference:

|Item|Screenshot|
|---|---|

|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|

|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|

### 🧪 How to test
- Go to the observability alerts page and check the kibana-browser
request as shown above

### ✨ Possible future improvements

Allowing this logic to be provided by the consumer so that we can get
rid of custom implementations (Example: [APM custom execution
context](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))

---------

Co-authored-by: Anton Dosov <[email protected]>
Co-authored-by: Davis McPhee <[email protected]>
Co-authored-by: Marco Antonio Ghiani <[email protected]>
Co-authored-by: Elena Stoeva <[email protected]>
(cherry picked from commit 53748fd)

# Conflicts:
#	packages/react/kibana_context/render/render_provider.tsx
#	packages/react/kibana_context/root/BUILD.bazel
#	packages/react/kibana_context/root/root_provider.test.tsx
#	packages/react/kibana_context/root/root_provider.tsx
#	packages/react/kibana_context/root/tsconfig.json
@maryam-saeidi
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.17

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

maryam-saeidi added a commit that referenced this pull request Dec 19, 2024
… enableExecutionContextTracking flag (#204547) (#204798)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix context.pageName by fixing missing executionContext and add
enableExecutionContextTracking flag
(#204547)](#204547)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Maryam
Saeidi","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-18T12:59:23Z","message":"Fix
context.pageName by fixing missing executionContext and add
enableExecutionContextTracking flag (#204547)\n\nResolves
https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞
Summary\r\nThis PR fixes missing executionContext in sharedux router by
adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside
of the\r\n`KibanaRenderContextProvider`). (More context provided in
this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt
also introduces `enableExecutionContextTracking` to enable
tracking\r\nlogic to avoid creating a race condition for the existing
custom\r\nexecution context tracking implementations.\r\n\r\nI enabled
this flag for the observability plugin and here is
the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n###
🧪 How to test\r\n- Go to the observability alerts page and check the
kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future
improvements\r\n\r\nAllowing this logic to be provided by the consumer
so that we can get\r\nrid of custom implementations (Example: [APM
custom
execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by:
Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee
<[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani
<[email protected]>\r\nCo-authored-by: Elena Stoeva
<[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","Team:obs-ux-management"],"number":204547,"url":"https://github.com/elastic/kibana/pull/204547","mergeCommit":{"message":"Fix
context.pageName by fixing missing executionContext and add
enableExecutionContextTracking flag (#204547)\n\nResolves
https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞
Summary\r\nThis PR fixes missing executionContext in sharedux router by
adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside
of the\r\n`KibanaRenderContextProvider`). (More context provided in
this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt
also introduces `enableExecutionContextTracking` to enable
tracking\r\nlogic to avoid creating a race condition for the existing
custom\r\nexecution context tracking implementations.\r\n\r\nI enabled
this flag for the observability plugin and here is
the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n###
🧪 How to test\r\n- Go to the observability alerts page and check the
kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future
improvements\r\n\r\nAllowing this logic to be provided by the consumer
so that we can get\r\nrid of custom implementations (Example: [APM
custom
execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by:
Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee
<[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani
<[email protected]>\r\nCo-authored-by: Elena Stoeva
<[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204547","number":204547,"mergeCommit":{"message":"Fix
context.pageName by fixing missing executionContext and add
enableExecutionContextTracking flag (#204547)\n\nResolves
https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞
Summary\r\nThis PR fixes missing executionContext in sharedux router by
adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside
of the\r\n`KibanaRenderContextProvider`). (More context provided in
this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt
also introduces `enableExecutionContextTracking` to enable
tracking\r\nlogic to avoid creating a race condition for the existing
custom\r\nexecution context tracking implementations.\r\n\r\nI enabled
this flag for the observability plugin and here is
the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n###
🧪 How to test\r\n- Go to the observability alerts page and check the
kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future
improvements\r\n\r\nAllowing this logic to be provided by the consumer
so that we can get\r\nrid of custom implementations (Example: [APM
custom
execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by:
Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee
<[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani
<[email protected]>\r\nCo-authored-by: Elena Stoeva
<[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-management Observability Management User Experience Team v8.17.1 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execution context remains the same on every route change
7 participants