feat: emit diagnostics timeline

This commit is contained in:
Shakker
2026-04-29 19:07:02 +01:00
parent db6951088a
commit 097eed8cd8
7 changed files with 605 additions and 19 deletions

View File

@@ -12,6 +12,7 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { PluginInstallRecord } from "../config/types.plugins.js";
import type { GatewayRequestHandler } from "../gateway/server-methods/types.js";
import { openBoundaryFileSync } from "../infra/boundary-file-read.js";
import { measureDiagnosticsTimelineSpanSync } from "../infra/diagnostics-timeline.js";
import { createSubsystemLogger } from "../logging/subsystem.js";
import {
DEFAULT_MEMORY_DREAMING_PLUGIN_ID,
@@ -2136,7 +2137,18 @@ export function loadOpenClawPlugins(options: PluginLoadOptions = {}): PluginRegi
env,
warn: (message) => logger.warn(`[plugins] ${record.id}: ${message}`),
}));
installer(installParams);
measureDiagnosticsTimelineSpanSync(
"runtimeDeps.stage",
() => installer(installParams),
{
phase: "startup",
env,
attributes: {
pluginId: record.id,
dependencyCount: installSpecs.length,
},
},
);
},
logInstalled: (installedSpecs) => {
if (shouldActivate) {

View File

@@ -1,4 +1,5 @@
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { measureDiagnosticsTimelineSpanSync } from "../infra/diagnostics-timeline.js";
import { resolveInstalledPluginIndexPolicyHash } from "./installed-plugin-index-policy.js";
import type { InstalledPluginIndex } from "./installed-plugin-index.js";
import {
@@ -123,6 +124,23 @@ export function buildPluginMetadataOwnerMaps(
export function loadPluginMetadataSnapshot(
params: LoadPluginMetadataSnapshotParams,
): PluginMetadataSnapshot {
return measureDiagnosticsTimelineSpanSync(
"plugins.metadata.scan",
() => loadPluginMetadataSnapshotImpl(params),
{
phase: "startup",
env: params.env,
attributes: {
hasWorkspaceDir: params.workspaceDir !== undefined,
hasInstalledIndex: params.index !== undefined,
},
},
);
}
function loadPluginMetadataSnapshotImpl(
params: LoadPluginMetadataSnapshotParams,
): PluginMetadataSnapshot {
const totalStartedAt = performance.now();
const registryStartedAt = performance.now();