Skip to content

[Actionable Observability] Application usage for Alerts, Cases, Rules views#132006

Merged
mgiota merged 7 commits intoelastic:mainfrom
mgiota:129340_usage_of_alerts_view
May 12, 2022
Merged

[Actionable Observability] Application usage for Alerts, Cases, Rules views#132006
mgiota merged 7 commits intoelastic:mainfrom
mgiota:129340_usage_of_alerts_view

Conversation

@mgiota
Copy link
Copy Markdown
Contributor

@mgiota mgiota commented May 11, 2022

Fixes #129339
Fixes #129340
Fixes #129341

@mgiota mgiota force-pushed the 129340_usage_of_alerts_view branch from 32be57a to eaf0a52 Compare May 11, 2022 09:12
@mgiota mgiota force-pushed the 129340_usage_of_alerts_view branch from eaf0a52 to 7da73a7 Compare May 11, 2022 09:13
@mgiota
Copy link
Copy Markdown
Contributor Author

mgiota commented May 11, 2022

@simianhacker Here's a very quick draft PR after applying what is mentioned here https://github.com/elastic/kibana/blob/main/src/plugins/kibana_usage_collection/server/collectors/application_usage/README.md. Question is how do I test the reporting of usage_collection?

@mgiota mgiota requested a review from simianhacker May 11, 2022 09:20
Comment thread x-pack/plugins/observability/public/plugin.ts Outdated
@mgiota mgiota marked this pull request as ready for review May 12, 2022 05:58
@mgiota mgiota self-assigned this May 12, 2022
@mgiota mgiota added Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.3.0 release_note:skip Skip the PR/issue when compiling release notes labels May 12, 2022
@mgiota mgiota changed the title [Actionable Observability] Application usage for Alerts view [Actionable Observability] Application usage for Alerts, Cases, Rules views May 12, 2022
@mgiota
Copy link
Copy Markdown
Contributor Author

mgiota commented May 12, 2022

@afharo I did the manual testing and here's the telemetry that Kibana will send:

"application_usage": { 
    "observability-overview": {
         "appId": "observability-overview",
             "viewId": "main",
             "clicks_total": 16,
             "clicks_7_days": 16,
             "clicks_30_days": 16,
             "clicks_90_days": 16,
             "minutes_on_screen_total": 3.8112166666666667,
             "minutes_on_screen_7_days": 3.8112166666666667,
             "minutes_on_screen_30_days": 3.8112166666666667,
             "minutes_on_screen_90_days": 3.8112166666666667,
              "views": [
                {
                   "appId": "observability-overview",
                   "viewId": "alerts",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 0.8379166666666666,
                    "minutes_on_screen_7_days": 0.8379166666666666,
                    "minutes_on_screen_30_days": 0.8379166666666666,
                    "minutes_on_screen_90_days": 0.8379166666666666
                  },
                  {
                    "appId": "observability-overview",
                    "viewId": "rules",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 1.2151333333333334,
                    "minutes_on_screen_7_days": 1.2151333333333334,
                    "minutes_on_screen_30_days": 1.2151333333333334,
                    "minutes_on_screen_90_days": 1.2151333333333334
                  },
                  {
                    "appId": "observability-overview",
                    "viewId": "cases",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 0.7620333333333335,
                    "minutes_on_screen_7_days": 0.7620333333333335,
                    "minutes_on_screen_30_days": 0.7620333333333335,
                    "minutes_on_screen_90_days": 0.7620333333333335
                  }
                ]
              }
            },
}

What is considered as a click? When I click on the menu options in the Observability sidebar (for example cases or alerts), I would expect the number of clicks to increase in the subviews, but as you can see in my example above I get 0s. What get increased though are the number of clicks in the main view. Is this how it should be? I did a bit of manual testing in the security solution and I see same behavior there:

"securitySolutionUI": {
                "appId": "securitySolutionUI",
                "viewId": "main",
                "clicks_total": 12,
                "clicks_7_days": 12,
                "clicks_30_days": 12,
                "clicks_90_days": 12,
                "minutes_on_screen_total": 1.5534999999999999,
                "minutes_on_screen_7_days": 1.5534999999999999,
                "minutes_on_screen_30_days": 1.5534999999999999,
                "minutes_on_screen_90_days": 1.5534999999999999,
                "views": [
                  {
                    "appId": "securitySolutionUI",
                    "viewId": "alerts",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 0.31771666666666665,
                    "minutes_on_screen_7_days": 0.31771666666666665,
                    "minutes_on_screen_30_days": 0.31771666666666665,
                    "minutes_on_screen_90_days": 0.31771666666666665
                  },
                  {
                    "appId": "securitySolutionUI",
                    "viewId": "exceptions",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 0.06875,
                    "minutes_on_screen_7_days": 0.06875,
                    "minutes_on_screen_30_days": 0.06875,
                    "minutes_on_screen_90_days": 0.06875
                  },
                  {
                    "appId": "securitySolutionUI",
                    "viewId": "rules",
                    "clicks_total": 0,
                    "clicks_7_days": 0,
                    "clicks_30_days": 0,
                    "clicks_90_days": 0,
                    "minutes_on_screen_total": 2.48155,
                    "minutes_on_screen_7_days": 2.48155,
                    "minutes_on_screen_30_days": 2.48155,
                    "minutes_on_screen_90_days": 2.48155
                  }
                ]
              },

@mgiota mgiota requested a review from afharo May 12, 2022 08:11
@afharo
Copy link
Copy Markdown
Member

afharo commented May 12, 2022

What is considered as a click? When I click on the menu options in the Observability sidebar (for example cases or alerts), I would expect the number of clicks to increase in the subviews, but as you can see in my example above I get 0s. What get increased though are the number of clicks in the main view. Is this how it should be? I did a bit of manual testing in the security solution and I see same behavior there:

Application Usage tracks clicks inside that component (and the minutes that component is rendered on screen). In your example, the side menu is outside the sub-views, so any clicks in it will only account for the application's general clicks. As the user interacts with any buttons inside the sub-view, the clicks counter for that specific sub-view will grow appropriately.

I hope it makes sense.

For tracking clicks in specific buttons (like the navigation options in the menu), you can rely on the new click events that we automatically track in #131755

If you still think we should track the number of times a user enters an application/sub-view, we can extend Application Usage to track that as well :)

@mgiota
Copy link
Copy Markdown
Contributor Author

mgiota commented May 12, 2022

@afharo It makes total sense, thanks for clarifying! I also clicked a few times within the respective apps and I didn't see numbers increasing, but I guess I had to wait a bit. Will do a bit more testing now.

If you still think we should track the number of times a user enters an application/sub-view, we can extend Application Usage to track that as well :)

I think first step for our team was to add basic telemetry the way we did it in this PR. @vinaychandrasekhar Do you think this is something we would be interested in adding later on?

@afharo
Copy link
Copy Markdown
Member

afharo commented May 12, 2022

but I guess I had to wait a bit.

FYI, we report the UI usage to the server every 3 minutes to reduce the load on both ends (no need to run HTTP requests all the time). The exception is when changing tabs: we noticed that some browsers may put the timers to sleep, so we attempt to send the report as soon as the user goes to a different tab in their browser. What I mean is: if you don't want to wait 3 minutes to see the info reflected in the server, you can change to another tab in your browser and come back :)

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

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
observability 371 373 +2

Async chunks

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

id before after diff
observability 435.0KB 435.4KB +472.0B

Page load bundle

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

id before after diff
observability 92.0KB 92.2KB +179.0B
Unknown metric groups

API count

id before after diff
observability 374 376 +2

History

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

cc @mgiota

@mgiota mgiota removed the request for review from simianhacker May 12, 2022 11:00
@mgiota mgiota enabled auto-merge (squash) May 12, 2022 11:01
@mgiota
Copy link
Copy Markdown
Contributor Author

mgiota commented May 12, 2022

@afharo Let me know if I need to do any more changes in this PR.

Copy link
Copy Markdown
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.

LGTM! Just 2 nits to make the dependency TS declaration optional to match kibana.json.

appMountParameters: AppMountParameters;
ObservabilityPageTemplate: React.ComponentType<LazyObservabilityPageTemplateProps>;
kibanaFeatures: KibanaFeature[];
usageCollection: UsageCollectionSetup;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: this is declared as an optional dependency

Suggested change
usageCollection: UsageCollectionSetup;
usageCollection?: UsageCollectionSetup;

data: DataPublicPluginSetup;
triggersActionsUi: TriggersAndActionsUIPublicPluginSetup;
home?: HomePublicPluginSetup;
usageCollection: UsageCollectionSetup;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as my previous comment: kibana.json declares this dependency optional. We should account for it in TS.

@mgiota mgiota merged commit 6871c65 into elastic:main May 12, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label May 12, 2022
Bamieh pushed a commit to Bamieh/kibana that referenced this pull request May 16, 2022
… views (elastic#132006)

* add application usage to observability

* wrap Alerts page in a TrackApplicationView component

* define alerting pages in a config file

* add UsageCollectionSetup contract

* pass useCollection in the renderApp

* fix failing tests

* application usage for cases and rules
@mgiota
Copy link
Copy Markdown
Contributor Author

mgiota commented Jun 8, 2022

I'm putting here the manual steps needed to test telemetry:

To manually test your changes, you can go to Stack Management > Advanced Settings > bottom of the page Usage Data. Then click on "cluster data" to fetch an example of the telemetry that Kibana will send

@mgiota mgiota deleted the 129340_usage_of_alerts_view branch September 29, 2023 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage of Cases view Usage of Alerts view Usage of Rule Management view

4 participants