[Fleet] Rename usage collection object to 'fleet'. (#83407)
* Rename usage collection object to 'fleet'. * Update telemetry mapping. * Adjust naming. * Rename ingestManager -> fleet in telemetry collector
This commit is contained in:
parent
0bd9201506
commit
aa07f5c1d0
|
@ -6,6 +6,6 @@
|
|||
|
||||
import { FleetConfigType } from '..';
|
||||
|
||||
export const getIsFleetEnabled = (config: FleetConfigType) => {
|
||||
export const getIsAgentsEnabled = (config: FleetConfigType) => {
|
||||
return config.agents.enabled;
|
||||
};
|
||||
|
|
|
@ -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<Usage>({
|
||||
type: 'ingest_manager',
|
||||
const fleetCollector = usageCollection.makeUsageCollector<Usage>({
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1778,9 +1778,9 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ingest_manager": {
|
||||
"fleet": {
|
||||
"properties": {
|
||||
"fleet_enabled": {
|
||||
"agents_enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"agents": {
|
||||
|
|
Loading…
Reference in a new issue