diff --git a/x-pack/plugins/fleet/server/collectors/config_collectors.ts b/x-pack/plugins/fleet/server/collectors/config_collectors.ts index 8fb4924a2ccf0..f26e4261d573e 100644 --- a/x-pack/plugins/fleet/server/collectors/config_collectors.ts +++ b/x-pack/plugins/fleet/server/collectors/config_collectors.ts @@ -6,6 +6,6 @@ import { FleetConfigType } from '..'; -export const getIsFleetEnabled = (config: FleetConfigType) => { +export const getIsAgentsEnabled = (config: FleetConfigType) => { return config.agents.enabled; }; diff --git a/x-pack/plugins/fleet/server/collectors/register.ts b/x-pack/plugins/fleet/server/collectors/register.ts index e7d95a7e83773..35517e6a7a700 100644 --- a/x-pack/plugins/fleet/server/collectors/register.ts +++ b/x-pack/plugins/fleet/server/collectors/register.ts @@ -6,19 +6,19 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; import { CoreSetup } from 'kibana/server'; -import { getIsFleetEnabled } from './config_collectors'; +import { getIsAgentsEnabled } from './config_collectors'; import { AgentUsage, getAgentUsage } from './agent_collectors'; import { getInternalSavedObjectsClient } from './helpers'; import { PackageUsage, getPackageUsage } from './package_collectors'; import { FleetConfigType } from '..'; interface Usage { - fleet_enabled: boolean; + agents_enabled: boolean; agents: AgentUsage; packages: PackageUsage[]; } -export function registerIngestManagerUsageCollector( +export function registerFleetUsageCollector( core: CoreSetup, config: FleetConfigType, usageCollection: UsageCollectionSetup | undefined @@ -30,19 +30,19 @@ export function registerIngestManagerUsageCollector( } // create usage collector - const ingestManagerCollector = usageCollection.makeUsageCollector({ - type: 'ingest_manager', + const fleetCollector = usageCollection.makeUsageCollector({ + type: 'fleet', isReady: () => true, fetch: async () => { const soClient = await getInternalSavedObjectsClient(core); return { - fleet_enabled: getIsFleetEnabled(config), + agents_enabled: getIsAgentsEnabled(config), agents: await getAgentUsage(soClient), packages: await getPackageUsage(soClient), }; }, schema: { - fleet_enabled: { type: 'boolean' }, + agents_enabled: { type: 'boolean' }, agents: { total: { type: 'long' }, online: { type: 'long' }, @@ -61,5 +61,5 @@ export function registerIngestManagerUsageCollector( }); // register usage collector - usageCollection.registerCollector(ingestManagerCollector); + usageCollection.registerCollector(fleetCollector); } diff --git a/x-pack/plugins/fleet/server/plugin.ts b/x-pack/plugins/fleet/server/plugin.ts index 90fb34efd4817..716939c28bf1e 100644 --- a/x-pack/plugins/fleet/server/plugin.ts +++ b/x-pack/plugins/fleet/server/plugin.ts @@ -71,7 +71,7 @@ import { } from './services/agents'; import { CloudSetup } from '../../cloud/server'; import { agentCheckinState } from './services/agents/checkin/state'; -import { registerIngestManagerUsageCollector } from './collectors/register'; +import { registerFleetUsageCollector } from './collectors/register'; import { getInstallation } from './services/epm/packages'; export interface FleetSetupDeps { @@ -216,7 +216,7 @@ export class FleetPlugin const config = await this.config$.pipe(first()).toPromise(); // Register usage collection - registerIngestManagerUsageCollector(core, config, deps.usageCollection); + registerFleetUsageCollector(core, config, deps.usageCollection); // Always register app routes for permissions checking registerAppRoutes(router); diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 8936cdafa3827..e1b5f4cb9c3ae 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -1778,9 +1778,9 @@ } } }, - "ingest_manager": { + "fleet": { "properties": { - "fleet_enabled": { + "agents_enabled": { "type": "boolean" }, "agents": {