-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Discover] Extend EBT context with a list of activated context-aware profiles #192908
Conversation
…-ebt # Conflicts: # src/plugins/discover/public/plugin.tsx
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Noticed an issue that once Discover is visited all following EBT events on other Kibana pages still have |
I do agree this would be great, if we could do that, I think it was discussed as an acceptable tradeoff in an one older discussion if we can't. Just wanted to ask @davismcphee @flash1293, we are adding |
…-ebt # Conflicts: # src/plugins/discover/tsconfig.json
I updated the approach, so now it should set and update Open for suggestions if |
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 changes look good and it works well, thanks! Left a few minor comments but nothing blocking.
Personally I'm ok with using a Discover specific property name to start since we don't know much about how profiles could work outside of Discover yet. We can always adjust later if needed. My only suggestion would be that maybe discoverProfiles
would be clearer than dscProfiles
for those unfamiliar with the property, but I'm happy with it either way.
@@ -130,6 +134,7 @@ export class ProfilesManager { | |||
return; | |||
} | |||
|
|||
this.trackActiveProfiles(this.rootContext$.getValue().profileId, context.profileId); |
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.
Should we also call this during resolveRootProfile
in the case that an event could fire between when the root profile is resolved and the data source profile is resolved? Probably not particularly likely, but maybe possible in cases where searchOnPageLoad
is off?
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.
@davismcphee I don't think that it would be helpful to report a default default-data-source-profile
in this case. Better to track the active profiles when users actually access their data and we know for sure what data source was it. Then we would have a cleaner reporting regarding the usage of one profile versus another.
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.
Fair enough 👍 It's easy enough change later on anyway if we ever identify a need for this
constructor() {} | ||
|
||
// https://docs.elastic.dev/telemetry/collection/event-based-telemetry | ||
public register({ core }: { core: CoreSetup }) { |
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.
Nit: Initially I was confused about what register
actually did until I read the code. I wonder if something like initialize
would be clearer for this?
type: 'keyword', | ||
_meta: { | ||
description: | ||
'List of profiles which are activated by Discover Context Awareness logic', |
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.
'List of profiles which are activated by Discover Context Awareness logic', | |
'List of active Discover context awareness profiles', |
Just a suggestion for a potentially simpler description.
@@ -354,6 +373,7 @@ export class DiscoverPlugin | |||
history: this.historyService.getHistory(), | |||
urlTracker: this.urlTracker!, | |||
profilesManager, | |||
ebtContextManager: profilesManager.ebtContextManager, |
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.
Rather than making profilesManager.ebtContextManager
public, could we instead make it private and just pass ebtContextManager
to getDiscoverServices
? It feels like the EBT manager should be just an implementation detail of the profiles manager.
); | ||
} | ||
|
||
private createEmptyProfilesManager() { | ||
return new ProfilesManager( | ||
new RootProfileService(), | ||
new DataSourceProfileService(), | ||
new DocumentProfileService() | ||
new DocumentProfileService(), | ||
new DiscoverEBTContextManager() // it's not enabled outside of Discover |
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.
I sort of overlooked that this approach wouldn't work for embeddables in our initial discussions about it. I think it works well for events in Discover and we should keep it, but I also feel like we may need an additional approach later not based around global EBT context to help track events in dashboard panels. This still seems like a great place to start though since Discover usage is most important right now.
@davismcphee Thanks for the review! I renamed to |
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.
Latest changes LGTM 👍 Thanks for improving our telemetry!
@@ -130,6 +134,7 @@ export class ProfilesManager { | |||
return; | |||
} | |||
|
|||
this.trackActiveProfiles(this.rootContext$.getValue().profileId, context.profileId); |
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.
Fair enough 👍 It's easy enough change later on anyway if we ever identify a need for this
💚 Build Succeeded
Metrics [docs]Module Count
Page load bundle
History
To update your PR or re-run it, just comment with: cc @jughosta |
…profiles (elastic#192908) - Closes elastic#186109 ## Summary This PR extends EBT context with `dscProfiles` - a list of active context-aware profiles. <img width="981" alt="Screenshot 2024-09-16 at 17 30 47" src="https://github.com/user-attachments/assets/64d49abc-3ee0-4d5a-8283-cdca5d78f963"> ## Testing Enable "Usage collection" global setting. Navigate to Discover and observe `kibana-browser` requests in Network tab. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit c28af87)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…aware profiles (#192908) (#193926) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Extend EBT context with a list of activated context-aware profiles (#192908)](#192908) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-24T21:08:21Z","message":"[Discover] Extend EBT context with a list of activated context-aware profiles (#192908)\n\n- Closes https://github.com/elastic/kibana/issues/186109\r\n\r\n## Summary\r\n\r\nThis PR extends EBT context with `dscProfiles` - a list of active\r\ncontext-aware profiles.\r\n\r\n<img width=\"981\" alt=\"Screenshot 2024-09-16 at 17 30 47\"\r\nsrc=\"https://github.com/user-attachments/assets/64d49abc-3ee0-4d5a-8283-cdca5d78f963\">\r\n\r\n\r\n## Testing\r\n\r\nEnable \"Usage collection\" global setting.\r\n\r\nNavigate to Discover and observe `kibana-browser` requests in Network\r\ntab.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"c28af871d2fa4d8e9f0edd0eafad4d10669a62f5","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor","Project:OneDiscover"],"title":"[Discover] Extend EBT context with a list of activated context-aware profiles","number":192908,"url":"https://github.com/elastic/kibana/pull/192908","mergeCommit":{"message":"[Discover] Extend EBT context with a list of activated context-aware profiles (#192908)\n\n- Closes https://github.com/elastic/kibana/issues/186109\r\n\r\n## Summary\r\n\r\nThis PR extends EBT context with `dscProfiles` - a list of active\r\ncontext-aware profiles.\r\n\r\n<img width=\"981\" alt=\"Screenshot 2024-09-16 at 17 30 47\"\r\nsrc=\"https://github.com/user-attachments/assets/64d49abc-3ee0-4d5a-8283-cdca5d78f963\">\r\n\r\n\r\n## Testing\r\n\r\nEnable \"Usage collection\" global setting.\r\n\r\nNavigate to Discover and observe `kibana-browser` requests in Network\r\ntab.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"c28af871d2fa4d8e9f0edd0eafad4d10669a62f5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192908","number":192908,"mergeCommit":{"message":"[Discover] Extend EBT context with a list of activated context-aware profiles (#192908)\n\n- Closes https://github.com/elastic/kibana/issues/186109\r\n\r\n## Summary\r\n\r\nThis PR extends EBT context with `dscProfiles` - a list of active\r\ncontext-aware profiles.\r\n\r\n<img width=\"981\" alt=\"Screenshot 2024-09-16 at 17 30 47\"\r\nsrc=\"https://github.com/user-attachments/assets/64d49abc-3ee0-4d5a-8283-cdca5d78f963\">\r\n\r\n\r\n## Testing\r\n\r\nEnable \"Usage collection\" global setting.\r\n\r\nNavigate to Discover and observe `kibana-browser` requests in Network\r\ntab.\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"c28af871d2fa4d8e9f0edd0eafad4d10669a62f5"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <[email protected]>
Summary
This PR extends EBT context with
discoverProfiles
- a list of active context-aware profiles.Testing
Enable "Usage collection" global setting.
Navigate to Discover and observe
kibana-browser
requests in Network tab.Checklist