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

Telemetry for Global Search #160224

Merged

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Jun 22, 2023

Summary

Closes #158880

global_search_bar_click_application global_search_bar_click_saved_object global_search_bar_blur global_search_bar_error
application: string X
saved_object_type: string X
terms: string X X X
selected_rank: number X X
selected_label: string X X
focus_time_ms: number X
error_message X

NOTE: The "blur" event needs to be created any time the user dismisses the search bar, whether or not a selection has been made. Therefore, the action of a user selecting an option in the global search will yield two separate events.

Checklist

Delete any items that are not applicable to this PR.

@tsullivan tsullivan force-pushed the serverless/add-global-search-telemetry branch 7 times, most recently from 5f79d3f to 147ecd0 Compare June 22, 2023 23:04
@tsullivan tsullivan force-pushed the serverless/add-global-search-telemetry branch from 147ecd0 to eb29ae5 Compare June 23, 2023 23:52
@tsullivan tsullivan changed the title Serverless/add global search telemetry Telemetry for Global Search Jun 24, 2023
@tsullivan tsullivan added Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Project:Serverless Work as part of the Serverless project for its initial release labels Jun 24, 2023
@tsullivan tsullivan self-assigned this Jun 24, 2023
@tsullivan tsullivan added the release_note:skip Skip the PR/issue when compiling release notes label Jun 24, 2023
@tsullivan tsullivan marked this pull request as ready for review June 24, 2023 01:16
@tsullivan tsullivan requested a review from a team as a code owner June 24, 2023 01:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

public searchFocus() {
this.trackUiMetric(METRIC_TYPE.COUNT, CountMetric.SEARCH_FOCUS);

this.focusStart = new Date(Date.now()).valueOf();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not simply: this.focusStart = Date.now(); 😊 Same on L71

public searchBlur() {
const focusTime = new Date(Date.now()).valueOf() - this.focusStart;
if (focusTime > 0) {
this.deps.analytics.reportEvent(EventMetric.SEARCH_BLUR, {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the same way you have an alias for this.tracUiMetric we could have an alias of this.deps.analytics.reportEvent in this.reportEvent?

const createBatch = (...results: Result[]): GlobalSearchBatchedResults => ({
results: results.map(createResult),
});
jest.useFakeTimers({ legacyFakeTimers: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

I never know if this affects other tests 😊 So I put it in a beforeAll and then in an afterAll I call jest. useRealTimers() ... just in case

@tsullivan tsullivan force-pushed the serverless/add-global-search-telemetry branch from 0330eb2 to 982633d Compare June 26, 2023 23:45
@tsullivan
Copy link
Member Author

Thanks @seb. I agreed with your feedback and have addressed it. Would you mind taking another look?

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
globalSearchBar 33 37 +4

Page load bundle

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

id before after diff
globalSearchBar 22.4KB 26.2KB +3.7KB
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 413 417 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 492 496 +4
total +6

History

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

cc @tsullivan

@tsullivan tsullivan merged commit 81c6a90 into elastic:main Jun 27, 2023
@tsullivan tsullivan deleted the serverless/add-global-search-telemetry branch June 27, 2023 15:09
@kibanamachine kibanamachine added v8.10.0 backport:skip This commit does not require backporting labels Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Project:Serverless Work as part of the Serverless project for its initial release release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instrument additional telemetry collection for Global Search
6 participants