-
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
[Discover] Adding uiMetric to track Visualize link click #82344
Conversation
@elasticmachine merge upstream |
Pinging @elastic/kibana-app (Team:KibanaApp) |
ACK, will review |
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.
Tested in all browsers, works as expected 👍 Great to have telemetry in Discover. Added some minor code comments to discuss
@@ -67,6 +68,7 @@ export interface DiscoverServices { | |||
getSavedSearchUrlById: (id: string) => Promise<string>; | |||
getEmbeddableInjector: any; | |||
uiSettings: IUiSettingsClient; | |||
trackUiMetric: (metricType: UiStatsMetricType, eventName: string | string[]) => void; |
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'd suggest, since trackUiMetric
can be undefined, this should be considered in the type
trackUiMetric: (metricType: UiStatsMetricType, eventName: string | string[]) => void; | |
trackUiMetric?: (metricType: UiStatsMetricType, eventName: string | string[]) => void; |
@@ -106,5 +113,6 @@ export async function buildServices( | |||
timefilter: plugins.data.query.timefilter.timefilter, | |||
toastNotifications: core.notifications.toasts, | |||
uiSettings: core.uiSettings, | |||
trackUiMetric, |
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.
you could save a few lines here
trackUiMetric: usageCollection?.reportUiStats.bind(usageCollection, 'discover')
* @param metricType | ||
* @param eventName | ||
*/ | ||
trackUiMetric: (metricType: UiStatsMetricType, eventName: string | string[]) => void; |
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.
Think, trackUiMetric
should be optional
trackUiMetric: (metricType: UiStatsMetricType, eventName: string | string[]) => void; | |
trackUiMetric?: (metricType: UiStatsMetricType, eventName: string | string[]) => void; |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
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 LGTM, didn't test a second time due to only small code changes, great that Discover will provide more insights about the user behavior in the future!
* master: (127 commits) [ILM] Fix breadcrumbs (elastic#82594) [UX]Swap env filter with percentile (elastic#82246) Add platform's missing READMEs (elastic#82268) [Discover] Adding uiMetric to track Visualize link click (elastic#82344) [Search] Add used index pattern name to the search agg error field (elastic#82604) improve client-side SO client get pooling (elastic#82603) [Security Solution] Unskips Overview tests (elastic#82459) Embeddables/migrations (elastic#82296) [Enterprise Search] Refactor product server route registrations to their own files/folders (elastic#82663) Moving reinstall function outside of promise.all (elastic#82672) Load choropleth layer correctly (elastic#82628) Master backport elastic#81233 (elastic#82642) [Fleet] Allow snake cased Kibana assets (elastic#77515) Reduce saved objects authorization checks (elastic#82204) [data.search] Add request handler context and asScoped pattern (elastic#80775) [ML] Fixes formatting of fields in index data visualizer (elastic#82593) Usage collector readme (elastic#82548) [Lens] Visualization validation and better error messages (elastic#81439) [ML] Add annotation markers to time series brush area to indicate annotations exist outside of selected range (elastic#81490) chore(NA): install microdnf in UBI docker build only (elastic#82611) ...
…2697) * [Discover] Adding uiMetric around Visualize link click * Change metric name * Fixing wrong merge * Applying PR fixes Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Summary
As part of #58747, one of the metrics we'd like to add is "count the number of times Visualize is clicked from the field list". This PR introduces
trackUiMetric
to Discover and tracks metric for visualize link click.I tested this by querying
SavedObjects
API:<URL>/api/saved_objects/_find?type=ui-metric
which returned a saved object with the following structure
Checklist
Delete any items that are not applicable to this PR.
- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)- [ ] This was checked for cross-browser compatibilityFor maintainers