Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ResponseOps][MW] Add telemetry for the maintenance window (#19…
…2483) (#193395) # Backport This will backport the following commits from `main` to `8.x`: - [[ResponseOps][MW] Add telemetry for the maintenance window (#192483)](#192483) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-19T08:28:48Z","message":"[ResponseOps][MW] Add telemetry for the maintenance window (#192483)\n\nResolve: https://github.com/elastic/kibana/issues/184088\r\n\r\nIn this PR add telemetry collection of these metrics:\r\n\r\n- total number of MW in deployments\r\n- number of active MW with \"repeat\" toggle on (time based)\r\n- number of active MW with \"filter alerts\" toggle on (KQL based)\r\n\r\n## Testing\r\n\r\nCreate several MW with different settings (toggles on and off)\r\nTo test changes reflected in telemetry object, \r\nmodify this file: `x-pack/plugins/alerting/server/usage/task.ts`\r\n\r\nWith:\r\n\r\n```\r\nasync function scheduleTasks(logger: Logger, taskManager: TaskManagerStartContract) {\r\n try {\r\n await taskManager.ensureScheduled({\r\n id: TASK_ID,\r\n taskType: TELEMETRY_TASK_TYPE,\r\n state: emptyState,\r\n params: {},\r\n schedule: SCHEDULE,\r\n });\r\n } catch (e) {\r\n logger.error(`Error scheduling ${TASK_ID}, received ${e.message}`);\r\n }\r\n await taskManager.runSoon(TASK_ID);\r\n}\r\n```\r\n\r\nThis will cause the telemetry to be sent as soon as the server is\r\nrestarted.\r\n\r\n**Run Telemetry usage payload API in your browser console to verify\r\ntelemetry object:**\r\n\r\nhttps://docs.elastic.dev/telemetry/collection/snapshot-telemetry#telemetry-usage-payload-api\r\nP.S.: Add space at the beginning of URL\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"eabb1022815a7c661a0e642c62d0a77ce338f9c9","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","v8.16.0"],"title":"[ResponseOps][MW] Add telemetry for the maintenance window","number":192483,"url":"https://github.com/elastic/kibana/pull/192483","mergeCommit":{"message":"[ResponseOps][MW] Add telemetry for the maintenance window (#192483)\n\nResolve: https://github.com/elastic/kibana/issues/184088\r\n\r\nIn this PR add telemetry collection of these metrics:\r\n\r\n- total number of MW in deployments\r\n- number of active MW with \"repeat\" toggle on (time based)\r\n- number of active MW with \"filter alerts\" toggle on (KQL based)\r\n\r\n## Testing\r\n\r\nCreate several MW with different settings (toggles on and off)\r\nTo test changes reflected in telemetry object, \r\nmodify this file: `x-pack/plugins/alerting/server/usage/task.ts`\r\n\r\nWith:\r\n\r\n```\r\nasync function scheduleTasks(logger: Logger, taskManager: TaskManagerStartContract) {\r\n try {\r\n await taskManager.ensureScheduled({\r\n id: TASK_ID,\r\n taskType: TELEMETRY_TASK_TYPE,\r\n state: emptyState,\r\n params: {},\r\n schedule: SCHEDULE,\r\n });\r\n } catch (e) {\r\n logger.error(`Error scheduling ${TASK_ID}, received ${e.message}`);\r\n }\r\n await taskManager.runSoon(TASK_ID);\r\n}\r\n```\r\n\r\nThis will cause the telemetry to be sent as soon as the server is\r\nrestarted.\r\n\r\n**Run Telemetry usage payload API in your browser console to verify\r\ntelemetry object:**\r\n\r\nhttps://docs.elastic.dev/telemetry/collection/snapshot-telemetry#telemetry-usage-payload-api\r\nP.S.: Add space at the beginning of URL\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"eabb1022815a7c661a0e642c62d0a77ce338f9c9"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192483","number":192483,"mergeCommit":{"message":"[ResponseOps][MW] Add telemetry for the maintenance window (#192483)\n\nResolve: https://github.com/elastic/kibana/issues/184088\r\n\r\nIn this PR add telemetry collection of these metrics:\r\n\r\n- total number of MW in deployments\r\n- number of active MW with \"repeat\" toggle on (time based)\r\n- number of active MW with \"filter alerts\" toggle on (KQL based)\r\n\r\n## Testing\r\n\r\nCreate several MW with different settings (toggles on and off)\r\nTo test changes reflected in telemetry object, \r\nmodify this file: `x-pack/plugins/alerting/server/usage/task.ts`\r\n\r\nWith:\r\n\r\n```\r\nasync function scheduleTasks(logger: Logger, taskManager: TaskManagerStartContract) {\r\n try {\r\n await taskManager.ensureScheduled({\r\n id: TASK_ID,\r\n taskType: TELEMETRY_TASK_TYPE,\r\n state: emptyState,\r\n params: {},\r\n schedule: SCHEDULE,\r\n });\r\n } catch (e) {\r\n logger.error(`Error scheduling ${TASK_ID}, received ${e.message}`);\r\n }\r\n await taskManager.runSoon(TASK_ID);\r\n}\r\n```\r\n\r\nThis will cause the telemetry to be sent as soon as the server is\r\nrestarted.\r\n\r\n**Run Telemetry usage payload API in your browser console to verify\r\ntelemetry object:**\r\n\r\nhttps://docs.elastic.dev/telemetry/collection/snapshot-telemetry#telemetry-usage-payload-api\r\nP.S.: Add space at the beginning of URL\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"eabb1022815a7c661a0e642c62d0a77ce338f9c9"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Julia <[email protected]>
- Loading branch information