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

[Data-Plugin] Add telemetry around query/filter bar usage #82709

Merged
merged 12 commits into from
Nov 11, 2020

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Nov 5, 2020

Summary

As part of #58747, we'd like to add a metric around "the number of times a query is submitted from search bar vs filter is added.

I tested this by querying saved objects API:
http://localhost:5601/dov/api/saved_objects/_find?type=ui-metric and inspecting the response:

{"type":"ui-metric","id":"discover:query_submit","attributes":{"count":6},"references":[],"updated_at":"2020-11-05T12:33:12.014Z","version":"WzEzMiwxXQ==","score":0},{"type":"ui-metric","id":"discover:filter_added","attributes":{"count":3},"references":[],"updated_at":"2020-11-05T12:33:43.107Z","version":"WzEzNywxXQ==","score":0}

This PR adds the trackUiMetric ability to data plugin. Additionally, it introduces metrics around query/filter bar usage:

  1. query_submitted metric, when a query is submitted from a search bar
  2. filter_added metric, when a filter is added from a filter bar
  3. filter_edited, when a filter is edited
  4. filter_invertInclusion when filter results are included/excluded
  5. filter_toggleAllDisabled when a filter is enabled/disabled

All metrics are prefixed with the appropriate appName for easier tracking.

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

For maintainers

@majagrubic majagrubic added release_note:roadmap v7.11.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Discover Discover Application labels Nov 5, 2020
@majagrubic majagrubic marked this pull request as ready for review November 5, 2020 14:32
@majagrubic majagrubic requested a review from a team November 5, 2020 14:32
@majagrubic majagrubic requested a review from a team as a code owner November 5, 2020 14:32
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@majagrubic majagrubic requested review from kertal and lizozom November 5, 2020 14:32
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

There seems to be a problem when you load the application multiple events are tracked
Bildschirmfoto 2020-11-06 um 08 45 19

what users use more filters or search bar - maybe calculate the number of times a query is submitted from search bar vs filter is added

dear @AlonaNadler maybe you meant the number of times a filter is added by using the field selector, the data table, the document view compared to the usage of the search bar including the filters there?

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

I think all apps would benefit from this. Lets add this directly into the SearchBar component for all apps.
Also avoiding adding new callbacks to this component is preferable, as we want to have an Observable base API.

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Nov 6, 2020
@majagrubic majagrubic changed the title [Discover] Add telemetry around query/filter bar usage [Data-Plugin] Add telemetry around query/filter bar usage Nov 6, 2020
@lizozom
Copy link
Contributor

lizozom commented Nov 6, 2020

@AlonaNadler
Copy link

AlonaNadler commented Nov 6, 2020

dear @AlonaNadler maybe you meant the number of times a filter is added by using the field selector, the data table, the document view compared to the usage of the search bar including the filters there?

@kertal I think you are right, can we add the number of times a filter is added either explicitly, from the table or the document view. Im addition can we collect the number of times users interact with the filter ? counting the number of times users use either edit filter, exclude or include results, and temporary disable or enable?

@lizozom
Copy link
Contributor

lizozom commented Nov 9, 2020

@elasticmachine merge upstream

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

Looks great. I think we can add the additional metrics @AlonaNadler suggests.
Can't wait to see the results.

}

export type StatefulSearchBarProps = SearchBarOwnProps & {
appName: string;
useDefaultBehaviors?: boolean;
savedQueryId?: string;
onSavedQueryIdChange?: (savedQueryId?: string) => void;
onFilterAdded?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was, you must be looking at the old commit 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

It's actually a comment from last week :-D
Sorry

@majagrubic majagrubic requested a review from kertal November 10, 2020 09:01
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 587 597 +10

Async chunks

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

id before after diff
data 235.0KB 245.4KB +10.4KB

Page load bundle

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

id before after diff
data 963.2KB 963.5KB +354.0B

History

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

Comment on lines +178 to +180
if (props.trackUiMetric) {
props.trackUiMetric(METRIC_TYPE.CLICK, `${props.appName}:filter_invertInclusion`);
}
Copy link
Member

Choose a reason for hiding this comment

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

@lizozom there are more functions here like onDisableAll, onPinAll, since this PR started to add metric to some of them this functions, I wonder if it makes sense to add metric to all of them?

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested locally, works 👍 in Discover, Visualize, Dashboard , added a note if it makes sense to add more metrics, and would suggest to updated the PR's description with all new metrics that were introduced and if it also makes sense to track removing of filters?

@majagrubic
Copy link
Contributor Author

Thanks @kertal. I've updated the PR description. Not sure about adding more metrics - my feeling is we shouldn't be emitting unnecessary metrics if there is no need for that. But will defer the decision to @lizozom, since app-arch own these particular components.

@majagrubic majagrubic merged commit cb27a72 into elastic:master Nov 11, 2020
@majagrubic majagrubic deleted the discover-telemetry-2 branch November 11, 2020 12:18
majagrubic pushed a commit that referenced this pull request Nov 11, 2020
…83157)

* [Discover] Add telemetry around query/filter bar usage

* Updating documentation

* Adding a separate method for tracking query submit

* Updating doc changes

* Adding trackUiMetric to Data plugin

* Doc changes

* Do not make usageCollection a start dependency

* Updating documentation

* Adding metrics for filter inclusion, edit, and disabled

* updating docs

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@Dosant Dosant mentioned this pull request Feb 16, 2021
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application Feature:Embedding Embedding content via iFrame Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants