diff --git a/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry.ts b/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry.ts index 305cdfafc39c4..70009a422525c 100644 --- a/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry.ts +++ b/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry.ts @@ -40,6 +40,9 @@ export interface DashboardCollectorData { }; }; controls: ControlGroupTelemetry; + sections: { + total: number; + }; } export const getEmptyDashboardData = (): DashboardCollectorData => ({ @@ -50,6 +53,9 @@ export const getEmptyDashboardData = (): DashboardCollectorData => ({ by_type: {}, }, controls: initializeControlGroupTelemetry({}), + sections: { + total: 0, + }, }); export const getEmptyPanelTypeData = () => ({ @@ -92,6 +98,14 @@ export const collectPanelsByType = ( } }; +export const collectDashboardSections = ( + attributes: DashboardSavedObjectAttributes, + collectorData: DashboardCollectorData +) => { + collectorData.sections.total += attributes.sections?.length ?? 0; + return collectorData; +}; + export const controlsCollectorFactory = (embeddableService: EmbeddablePersistableStateService) => (attributes: DashboardSavedObjectAttributes, collectorData: DashboardCollectorData) => { diff --git a/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry_collection_task.ts b/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry_collection_task.ts index 3da2a9d731f72..a8febbd9be4cb 100644 --- a/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry_collection_task.ts +++ b/src/platform/plugins/shared/dashboard/server/usage/dashboard_telemetry_collection_task.ts @@ -22,6 +22,7 @@ import { controlsCollectorFactory, collectPanelsByType, getEmptyDashboardData, + collectDashboardSections, } from './dashboard_telemetry'; import type { DashboardSavedObjectAttributes, @@ -102,6 +103,7 @@ export function dashboardTaskRunner(logger: Logger, core: CoreSetup, embeddable: // }); dashboardData = controlsCollector(dashboard.attributes, dashboardData); + dashboardData = collectDashboardSections(dashboard.attributes, dashboardData); try { const panels = JSON.parse( diff --git a/src/platform/plugins/shared/dashboard/server/usage/register_collector.ts b/src/platform/plugins/shared/dashboard/server/usage/register_collector.ts index 7035ee0bea644..97a9ff68f826c 100644 --- a/src/platform/plugins/shared/dashboard/server/usage/register_collector.ts +++ b/src/platform/plugins/shared/dashboard/server/usage/register_collector.ts @@ -111,6 +111,15 @@ export function registerDashboardUsageCollector( }, }, }, + sections: { + total: { + type: 'long', + _meta: { + description: + 'Collection of telemetry metrics that count the number of collapsible sections on all dashboards', + }, + }, + }, }, }); diff --git a/src/platform/plugins/shared/dashboard/server/usage/task_state.ts b/src/platform/plugins/shared/dashboard/server/usage/task_state.ts index fa8df453c4424..b631e03fb213f 100644 --- a/src/platform/plugins/shared/dashboard/server/usage/task_state.ts +++ b/src/platform/plugins/shared/dashboard/server/usage/task_state.ts @@ -68,6 +68,7 @@ export const stateSchemaByVersion = { }) ), }), + sections: schema.object({ total: schema.number() }), }), }), }, @@ -92,5 +93,8 @@ export const emptyState: LatestTaskStateSchema = { label_position: {}, by_type: {}, }, + sections: { + total: 0, + }, }, }; diff --git a/src/platform/plugins/shared/telemetry/schema/oss_platform.json b/src/platform/plugins/shared/telemetry/schema/oss_platform.json index 4981e58e2ac7d..a63117e9017f3 100644 --- a/src/platform/plugins/shared/telemetry/schema/oss_platform.json +++ b/src/platform/plugins/shared/telemetry/schema/oss_platform.json @@ -9575,6 +9575,16 @@ } } } + }, + "sections": { + "properties": { + "total": { + "type": "long", + "_meta": { + "description": "Collection of telemetry metrics that count the number of collapsible sections on all dashboards" + } + } + } } } },