feat: Add startup profiler to measure and record application initialization phases. (#13638)

This commit is contained in:
Kevin Ramdass
2025-12-01 10:06:13 -08:00
committed by GitHub
parent 613fb2fed6
commit db027dd95b
10 changed files with 591 additions and 1 deletions
+5
View File
@@ -87,6 +87,7 @@ import { SubagentToolWrapper } from '../agents/subagent-tool-wrapper.js';
import { getExperiments } from '../code_assist/experiments/experiments.js';
import { ExperimentFlags } from '../code_assist/experiments/flagNames.js';
import { debugLogger } from '../utils/debugLogger.js';
import { startupProfiler } from '../telemetry/startupProfiler.js';
import { ApprovalMode } from '../policy/types.js';
@@ -620,6 +621,7 @@ export class Config {
this.initialized = true;
// Initialize centralized FileDiscoveryService
const discoverToolsHandle = startupProfiler.start('discover_tools');
this.getFileService();
if (this.getCheckpointingEnabled()) {
await this.getGitService();
@@ -630,15 +632,18 @@ export class Config {
await this.agentRegistry.initialize();
this.toolRegistry = await this.createToolRegistry();
discoverToolsHandle?.end();
this.mcpClientManager = new McpClientManager(
this.toolRegistry,
this,
this.eventEmitter,
);
const initMcpHandle = startupProfiler.start('initialize_mcp_clients');
await Promise.all([
await this.mcpClientManager.startConfiguredMcpServers(),
await this.getExtensionLoader().start(this),
]);
initMcpHandle?.end();
// Initialize hook system if enabled
if (this.enableHooks) {