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

Dashboard favorites telemetry #190706

Merged
merged 19 commits into from
Aug 29, 2024
Merged

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Aug 19, 2024

Summary

Add telemetry to favorites feature #189285

  • Adds UI usage counter telemetry, increase the counter when favorite / unfavorite is clicked
  • Add snapshot telemetry:
    • total "favorite" object in the deployment
    • total users+spaces count combination who have used the favorites feature
    • avg per user per space (only counts those users who favorited at least once)
    • max favorites objects per user per space

Unfortunately, for snapshot telemetry, I had to add fields to kibana mapping. We didn't need them for a feature, but I didn't realize that will have to add them to a mapping. Not sure if there is a better way

hidden: true,
namespaceType: 'single',
mappings: {
dynamic: false,
properties: {},
properties: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't need these mappings for the feature, but, unfortunately, I didn't know that we would need them for the snapshot telemetry. I am not sure if there is another better way

the object schema stays the same, but we add existing fields to the mapping

Copy link
Member

Choose a reason for hiding this comment

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

It's been my experience as well that it's sometimes necessary to add mappings just for the sake of being able to collect snapshot telemetry.

number_of_favorites: {
type: 'long',
script: {
source: "emit(doc['favorites.favoriteIds'].length)",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is the best way, but I like how clean it is to get sum, avg, max.

I've also tried value_count aggregation which works well for total, but haven't figure how it can be used for avg and max

Copy link
Member

@tsullivan tsullivan Aug 28, 2024

Choose a reason for hiding this comment

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

If you need other alternatives to consider, there is also the stats aggregation.

Running the aggregation on a runtime field seems like a perfect idea for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I updated to stats

@Dosant
Copy link
Contributor Author

Dosant commented Aug 21, 2024

/ci

@Dosant Dosant changed the title favorites telemetry Dashboard favorites telemetry Aug 22, 2024
@Dosant Dosant added release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) labels Aug 22, 2024
@Dosant Dosant marked this pull request as ready for review August 22, 2024 08:37
@Dosant Dosant requested review from a team as code owners August 22, 2024 08:37
@elasticmachine
Copy link
Contributor

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

@Dosant Dosant requested a review from afharo August 22, 2024 08:38
Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

Core changes LGTM

@@ -11,6 +11,7 @@
"../../../typings/**/*",
"schema/oss_plugins.json",
"schema/oss_root.json",
"schema/kbn_packages.json"
Copy link
Member

Choose a reason for hiding this comment

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

😮 Thanks!

@Dosant Dosant requested review from tsullivan and Heenawter August 26, 2024 12:20
@Dosant
Copy link
Contributor Author

Dosant commented Aug 28, 2024

@elasticmachine merge upstream

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Code review + quick local test to ensure the telemetry is collected as expected. LGTM 👍

Saved object telemetry UI Counters
image image

type: 'long',
_meta: {
description:
'Total unique users+spaces that have favorited an object of this type in this deployment',
Copy link
Member

Choose a reason for hiding this comment

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

I don't follow what users+spaces means. Does it mean users per space?

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'll adjust!


export function registerFavoritesUsageCollection({
core,
logger,
Copy link
Member

Choose a reason for hiding this comment

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

Should logger be used for anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cleaned it up

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM

Added a few conversational comments

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

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/content-management-favorites-public 38 44 +6
@kbn/content-management-favorites-server 6 7 +1
total +7

Async chunks

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

id before after diff
dashboard 547.3KB 547.7KB +430.0B
eventAnnotationListing 312.9KB 313.0KB +86.0B
filesManagement 120.5KB 120.6KB +86.0B
graph 413.1KB 413.2KB +86.0B
maps 3.0MB 3.0MB +86.0B
visualizations 302.1KB 302.2KB +86.0B
total +860.0B

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/saved-objects-service.html#_mappings

id before after diff
favorites - 4 +4
Unknown metric groups

API count

id before after diff
@kbn/content-management-favorites-public 39 45 +6
@kbn/content-management-favorites-server 6 7 +1
total +7

ESLint disabled line counts

id before after diff
contentManagement 7 6 -1

Total ESLint disabled count

id before after diff
contentManagement 7 6 -1

History

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

@Dosant Dosant merged commit ec0230b into elastic:main Aug 29, 2024
22 checks passed
@kibanamachine kibanamachine added v8.16.0 backport:skip This commit does not require backporting labels Aug 29, 2024
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 release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants