Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export interface DashboardCollectorData {
};
};
controls: ControlGroupTelemetry;
sections: {
total: number;
};
}

export const getEmptyDashboardData = (): DashboardCollectorData => ({
Expand All @@ -50,6 +53,9 @@ export const getEmptyDashboardData = (): DashboardCollectorData => ({
by_type: {},
},
controls: initializeControlGroupTelemetry({}),
sections: {
total: 0,
},
});

export const getEmptyPanelTypeData = () => ({
Expand Down Expand Up @@ -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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
controlsCollectorFactory,
collectPanelsByType,
getEmptyDashboardData,
collectDashboardSections,
} from './dashboard_telemetry';
import type {
DashboardSavedObjectAttributes,
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const stateSchemaByVersion = {
})
),
}),
sections: schema.object({ total: schema.number() }),
}),
}),
},
Expand All @@ -92,5 +93,8 @@ export const emptyState: LatestTaskStateSchema = {
label_position: {},
by_type: {},
},
sections: {
total: 0,
},
},
};
10 changes: 10 additions & 0 deletions src/platform/plugins/shared/telemetry/schema/oss_platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -9962,6 +9962,16 @@
}
}
}
},
"sections": {
"properties": {
"total": {
"type": "long",
"_meta": {
"description": "Collection of telemetry metrics that count the number of collapsible sections on all dashboards"
}
}
}
}
}
},
Expand Down