in x-pack/platform/plugins/shared/spaces/server/usage_collection/spaces_usage_collector.ts [191:533]
export function getSpacesUsageCollector(
usageCollection: UsageCollectionSetup,
deps: CollectorDeps
) {
return usageCollection.makeUsageCollector<UsageData>({
type: 'spaces',
isReady: () => true,
schema: {
usesFeatureControls: {
type: 'boolean',
_meta: {
description:
'Indicates if at least one feature is disabled in at least one space. This is a signal that space-level feature controls are in use. This does not account for role-based (security) feature controls.',
},
},
solutions: {
classic: {
type: 'long',
_meta: {
description: 'The number of spaces which have solution set to classic.',
},
},
es: {
type: 'long',
_meta: {
description: 'The number of spaces which have solution set to search.',
},
},
oblt: {
type: 'long',
_meta: {
description: 'The number of spaces which have solution set to observability.',
},
},
security: {
type: 'long',
_meta: {
description: 'The number of spaces which have solution set to security.',
},
},
unset: {
type: 'long',
_meta: {
description: 'The number of spaces without solution set.',
},
},
},
disabledFeatures: {
// "feature": number;
DYNAMIC_KEY: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
// Known registered features
stackAlerts: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
actions: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
enterpriseSearch: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
fleet: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
savedObjectsTagging: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
indexPatterns: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
discover: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
canvas: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
maps: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
siem: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
monitoring: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
graph: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
uptime: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
savedObjectsManagement: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
dev_tools: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
advancedSettings: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
infrastructure: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
visualize: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
logs: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
dashboard: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
ml: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
apm: {
type: 'long',
_meta: {
description: 'The number of spaces which have this feature disabled.',
},
},
},
available: {
type: 'boolean',
_meta: {
description: 'Indicates if the Spaces feature is available in this installation.',
},
},
enabled: {
type: 'boolean',
_meta: {
description: 'Indicates if the Spaces feature is enabled in this installation.',
},
},
count: {
type: 'long',
_meta: {
description: 'The number of spaces in this installation.',
},
},
'apiCalls.copySavedObjects.total': {
type: 'long',
_meta: {
description: 'The number of times the "Copy Saved Objects" API has been called.',
},
},
'apiCalls.copySavedObjects.kibanaRequest.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called via the Kibana client.',
},
},
'apiCalls.copySavedObjects.kibanaRequest.no': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called via an API consumer (e.g. curl).',
},
},
'apiCalls.copySavedObjects.createNewCopiesEnabled.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "createNewCopies" set to true.',
},
},
'apiCalls.copySavedObjects.createNewCopiesEnabled.no': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "createNewCopies" set to false.',
},
},
'apiCalls.copySavedObjects.overwriteEnabled.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "overwrite" set to true.',
},
},
'apiCalls.copySavedObjects.overwriteEnabled.no': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "overwrite" set to false.',
},
},
'apiCalls.copySavedObjects.compatibilityModeEnabled.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "compatibilityMode" set to true.',
},
},
'apiCalls.copySavedObjects.compatibilityModeEnabled.no': {
type: 'long',
_meta: {
description:
'The number of times the "Copy Saved Objects" API has been called with "compatibilityMode" set to false.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.total': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.kibanaRequest.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called via the Kibana client.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.kibanaRequest.no': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called via an API consumer (e.g. curl).',
},
},
'apiCalls.resolveCopySavedObjectsErrors.createNewCopiesEnabled.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called with "createNewCopies" set to true.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.createNewCopiesEnabled.no': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called with "createNewCopies" set to false.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.compatibilityModeEnabled.yes': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called with "compatibilityMode" set to true.',
},
},
'apiCalls.resolveCopySavedObjectsErrors.compatibilityModeEnabled.no': {
type: 'long',
_meta: {
description:
'The number of times the "Resolve Copy Saved Objects Errors" API has been called with "compatibilityMode" set to false.',
},
},
'apiCalls.disableLegacyUrlAliases.total': {
type: 'long',
_meta: {
description: 'The number of times the "Disable Legacy URL Aliases" API has been called.',
},
},
},
fetch: async ({ esClient }: CollectorFetchContext) => {
const { licensing, getIndexForType, features, usageStatsServicePromise } = deps;
const license = await firstValueFrom(licensing.license$);
const available = license.isAvailable; // some form of spaces is available for all valid licenses
const spaceIndex = await getIndexForType('space');
const usageData = await getSpacesUsage(esClient, spaceIndex, features, available);
const usageStats = await getUsageStats(usageStatsServicePromise, available);
return {
available,
enabled: available,
...usageData,
...usageStats,
} as UsageData;
},
});
}