[Cloud Security] Adding telemetry collection condition based on render condition#208758
[Cloud Security] Adding telemetry collection condition based on render condition#208758JordanSh merged 9 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security) |
| const hasMisconfigurationFindings = totalFindings > 0; | ||
| const shouldRender = totalFindings > 0; // this component only renders if there are findings | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
While it's a fix over the previous version where we tracked even when the particular insight wasn't even rendered, I wonder what do we want to track overall? With this change the counter will go up with every re-render of the component, for example when a user expands the left pane, switches between Overview, Table, JSON tabs and who knows when else as it's hard to reason about reliable component rerender in React. If our goal is to understand how many users had the component showing up at least once, I guess the current approach would do. But it's harder to make more complex conclusions from this telemetry. Probably not for this PR, but we have a preview link in the component from the counter. We could count clicks to track actual interactions with the component. Or if we want to see for how many alerts per user the data is present, we need to add an alert uuid to tracking to be able to then group by re-renders for the same alerts
There was a problem hiding this comment.
good point max. I believe this was solved by [Cloud Security] Collecting telemetry of graph visualization usage
There was a problem hiding this comment.
I’m curious why the condition is checked in MisconfigurationsInsight (and in VulnerabilitiesInsight) before calling them. In other words, why not call these functions only if there are findings?
There was a problem hiding this comment.
not sure what you mean, this is exactly whats happening. flow is:
Checking we have findings, which is also the render condition
const shouldRender = totalFindings > 0; // this component only renders if there are findingsif shouldRender is true (meaning we have findings), report metric
if (shouldRender && telemetryKey) {
uiMetricService.trackUiMetric(METRIC_TYPE.COUNT, telemetryKey);
}Meaning we only call the function if there are findings
There was a problem hiding this comment.
@JordanSh I checked and every switch between Overview/Table/JSON tabs still increases the counter. Again, not sure if it's a problem concerning this particular PR, I'm just wondering what we actually want to count with the current approach and if we are able to clean those meaningful counts on the reporting side
There was a problem hiding this comment.
We can add that as well, i dont think it replaces this view count that we are trying to measure. Thanks for letting me know!
@CohenIdo do we want to add tracker for those counter clicks?
| export const MISCONFIGURATION_INSIGHT = 'misconfiguration-insight-v2' as const; | ||
| export const VULNERABILITIES_INSIGHT = 'vulnerabilities-insight-v2' as const; |
There was a problem hiding this comment.
As requested by @CohenIdo, added version to namings so it will be easier to track fixed version telemetry reports
|
/ci |
|
@JordanSh, please add a backport to 8.x and 9.0, we should ensure it’s included in the next BC. Otherwise, we might lose track of it for the upcoming release. |
| const shouldRender = totalFindings > 0; // this component only renders if there are findings | ||
|
|
||
| useEffect(() => { | ||
| if (shouldRender && telemetryKey) { |
There was a problem hiding this comment.
Have you considered typing telemetryKey it as required? Looks like it is always passed
There was a problem hiding this comment.
yeah makes sense, can do that
ended up not doing that, it isn't required for tests, and in general only required for telemetry and not for the component it self in order to function. for those reasons i've decided to keep it optional for now.
| const hasMisconfigurationFindings = totalFindings > 0; | ||
| const shouldRender = totalFindings > 0; // this component only renders if there are findings | ||
|
|
||
| useEffect(() => { |
|
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
cc @JordanSh |
|
Starting backport for target branches: 8.18, 8.x, 9.0 https://github.com/elastic/kibana/actions/runs/13267784020 |
…r condition (elastic#208758) (cherry picked from commit c1aaf6f)
…r condition (elastic#208758) (cherry picked from commit c1aaf6f)
…r condition (elastic#208758) (cherry picked from commit c1aaf6f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
… render condition (#208758) (#210636) # Backport This will backport the following commits from `main` to `9.0`: - [[Cloud Security] Adding telemetry collection condition based on render condition (#208758)](#208758) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jordan","email":"51442161+JordanSh@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-11T16:33:02Z","message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud Security","backport:prev-minor","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Cloud Security] Adding telemetry collection condition based on render condition","number":208758,"url":"https://github.com/elastic/kibana/pull/208758","mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208758","number":208758,"mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jordan <51442161+JordanSh@users.noreply.github.com>
…n render condition (#208758) (#210634) # Backport This will backport the following commits from `main` to `8.18`: - [[Cloud Security] Adding telemetry collection condition based on render condition (#208758)](#208758) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jordan","email":"51442161+JordanSh@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-11T16:33:02Z","message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud Security","backport:prev-minor","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Cloud Security] Adding telemetry collection condition based on render condition","number":208758,"url":"https://github.com/elastic/kibana/pull/208758","mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208758","number":208758,"mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jordan <51442161+JordanSh@users.noreply.github.com>
…on-206439 * main: (402 commits) [Search]: Fix Number type field to have correct property (elastic#210462) Change filter for rule monitoring gaps (elastic#209983) Update Logs Explorer deprecation messages (elastic#201307) [APM] Remove `error.id` in `getErrorGroupMainStatistics` query as it's not used (elastic#210613) [Embeddable] Fix presentation panel styles (elastic#210113) [ci] enable Scout reporter for on-merge-unsupported-ftrs (elastic#210627) [Fix][Synonyms UI]Add navigation link to the Detail breadcrumb. (elastic#209574) chore(dep): bump `store2` from `2.12.0` to `2.14.4` (elastic#210530) [scout] adding test helper `@kbn/scout-oblt` package and uptate onboarding tests (elastic#209761) [Cloud Security] Asset Inventory table flyout controls (elastic#208452) [ML] Fix model deployment check in file uploader (elastic#209585) Updates archive again (elastic#209828) [Security Solution] Added concurrency limits and request throttling to prebuilt rule routes (elastic#209551) [Search] [Onboarding] Update search api to use EventEmitter instead of Provider (elastic#209784) [maps] lazy load map actions (elastic#210252) [Cloud Security] Adding telemetry collection condition based on render condition (elastic#208758) [Solution nav] Use flyout for Stack Management in Search and Observability solutions (elastic#208632) [Search] Fix Add Inference Endpoint API call (elastic#210243) [Agentless Connectors] Integration overview panel (elastic#210222) [Lens] Restore dynamic colouring by value for Last value agg (elastic#209110) ...
… render condition (#208758) (#210635) # Backport This will backport the following commits from `main` to `8.x`: - [[Cloud Security] Adding telemetry collection condition based on render condition (#208758)](#208758) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jordan","email":"51442161+JordanSh@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-02-11T16:33:02Z","message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud Security","backport:prev-minor","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Cloud Security] Adding telemetry collection condition based on render condition","number":208758,"url":"https://github.com/elastic/kibana/pull/208758","mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208758","number":208758,"mergeCommit":{"message":"[Cloud Security] Adding telemetry collection condition based on render condition (#208758)","sha":"c1aaf6f38cfbe5c4093c7ffd7a1a3ec56b2787dc"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jordan <51442161+JordanSh@users.noreply.github.com>
Summary
Insight components telemetry is now reporting based on the rendering condition of the component