@camstack/server 1.2.718 → 1.2.720
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/addon-root-inventory.js +1 -1
- package/dist/agent/addon-scan.js +11 -7
- package/dist/agent/agent-addon-updates.js +1 -1
- package/dist/agent/agent-cap-dispatch-service.js +1 -1
- package/dist/agent/agent-heap-watch.js +1 -1
- package/dist/agent/agent-http.js +1 -1
- package/dist/agent/agent-hub-addon-update.js +1 -1
- package/dist/agent/agent-hub-registration.js +1 -1
- package/dist/agent/agent-infra-capabilities.js +2 -2
- package/dist/agent/agent-mesh-gate.js +1 -1
- package/dist/agent/agent-node-certificates.js +1 -1
- package/dist/agent/agent-pairing-routes.js +1 -1
- package/dist/agent/agent-pairing-store.js +1 -1
- package/dist/agent/agent-service.js +6 -2
- package/dist/agent/agent-update-service.js +3 -1
- package/dist/agent/hub-membership-client.js +1 -1
- package/dist/agent/infra-boot-guard.js +2 -2
- package/dist/agent/main.js +9 -9
- package/dist/api/addon-upload.js +1 -1
- package/dist/api/core/addon-settings.router.js +1 -1
- package/dist/api/core/agent-pairing.router.js +1 -1
- package/dist/api/core/auth-device-cert.procedures.js +1 -1
- package/dist/api/core/cap-providers.js +6 -6
- package/dist/api/core/certificates.router.js +1 -1
- package/dist/api/core/lifecycle-job-runner.js +1 -1
- package/dist/api/core/logging-settings.js +1 -1
- package/dist/api/core/logs.router.js +2 -2
- package/dist/api/core/notifications.router.js +1 -1
- package/dist/api/core/preferences.router.js +1 -1
- package/dist/api/core/repl.router.js +1 -1
- package/dist/api/cors/cors-policy.js +1 -1
- package/dist/api/mesh-membership-routes.js +1 -1
- package/dist/api/model-distributor.js +1 -1
- package/dist/api/trpc/cap-route-error-formatter.js +1 -1
- package/dist/api/trpc/cap-router-runtime.js +2 -2
- package/dist/api/trpc/core-cap-bridge.js +1 -1
- package/dist/api/trpc/device-collection-dispatch.js +1 -1
- package/dist/api/trpc/generated-cap-routers.js +1 -1
- package/dist/api/trpc/principal-authorization.js +1 -1
- package/dist/api/trpc/principal-visibility.js +1 -1
- package/dist/api/trpc/scope-access.js +1 -1
- package/dist/api/trpc/trpc.context.js +1 -1
- package/dist/api/trpc/trpc.middleware.js +1 -1
- package/dist/api/trpc/trpc.router.js +3 -3
- package/dist/auth/auth-network-policy.js +1 -1
- package/dist/auth/client-address.js +1 -1
- package/dist/auth/hub-sessions.js +1 -1
- package/dist/auth/session-lifetimes.js +1 -1
- package/dist/auth/sso-finish-deps.js +1 -1
- package/dist/boot/boot-config.js +53 -133
- package/dist/boot/platform-keychain-key.js +1 -1
- package/dist/boot/post-boot.service.js +1 -1
- package/dist/bootstrap-packages.js +3 -3
- package/dist/core/addon/addon-call-gateway.js +1 -1
- package/dist/core/addon/addon-package.service.js +140 -21
- package/dist/core/addon/addon-registry.service.js +36 -32
- package/dist/core/addon/addon-requirements.js +81 -0
- package/dist/core/addon/hub-addon-api.js +1 -1
- package/dist/core/addon/installed-addon-versions.js +82 -0
- package/dist/core/addon/package-dir-utils.js +11 -1
- package/dist/core/addon/settings-door-wiring.js +1 -1
- package/dist/core/addon-bridge/addon-bridge.service.js +3 -3
- package/dist/core/addon-pages/addon-pages.service.js +1 -1
- package/dist/core/agent/agent-desired-set.js +1 -1
- package/dist/core/agent/agent-pairing-http.js +1 -1
- package/dist/core/agent/agent-registry.service.js +41 -7
- package/dist/core/agent/cluster-node-history-store.js +1 -1
- package/dist/core/agent/delivery-requirements.js +36 -0
- package/dist/core/agent/forgotten-node-revoker.js +1 -1
- package/dist/core/agent/node-removal-hooks.js +6 -2
- package/dist/core/auth/auth.service.js +1 -1
- package/dist/core/config/config.schema.js +2 -2
- package/dist/core/config/config.service.js +1 -1
- package/dist/core/events/event-bus.service.js +1 -1
- package/dist/core/feature/feature.service.js +1 -1
- package/dist/core/lifecycle/lifecycle-state-machine.js +2 -2
- package/dist/core/logging/log-history.js +1 -1
- package/dist/core/logging/log-ring-buffer.js +2 -2
- package/dist/core/logging/logging.service.js +2 -2
- package/dist/core/logging/scoped-logger.js +2 -2
- package/dist/core/moleculer/cap-route-authority.js +2 -2
- package/dist/core/moleculer/hub-mesh-guard.js +1 -1
- package/dist/core/moleculer/moleculer.service.js +1 -1
- package/dist/core/network/network-quality.service.js +1 -1
- package/dist/core/notification/notification-wrapper.service.js +1 -1
- package/dist/core/notification/toast-wrapper.service.js +1 -1
- package/dist/core/repl/repl-engine.service.js +1 -1
- package/dist/core/server-update/server-update.service.js +3 -0
- package/dist/core/server-update/system-ensure-prebuilds.js +3 -3
- package/dist/core/server-update/system-exec-npm.js +2 -2
- package/dist/core/storage/fs-storage-backend.js +2 -2
- package/dist/core/storage/storage-location-manager.js +2 -2
- package/dist/core/storage/storage.service.js +1 -1
- package/dist/framework-nodepath.js +14 -1
- package/dist/launcher.js +23 -23
- package/dist/legacy-package-names.js +15 -0
- package/dist/main.js +2 -2
- package/dist/manual-boot.js +4 -3
- package/dist/package-inventory.js +6 -3
- package/dist/server-root/index.js +182 -30
- package/dist/single-copy-cleanup-runner.js +3 -3
- package/dist/single-copy-cleanup.js +19 -14
- package/package.json +53 -19
- package/scripts/closure-postinstall.mjs +1 -1
- package/system/assets/addon-pages-aggregator/icon.svg +5 -0
- package/system/assets/addon-widgets-aggregator/icon.svg +6 -0
- package/system/assets/alert-center/icon.svg +5 -0
- package/system/assets/autotrack/icon.svg +5 -0
- package/system/assets/backup-orchestrator/icon.svg +5 -0
- package/system/assets/calendars/icon.svg +5 -0
- package/system/assets/camera-grid/icon.svg +10 -0
- package/system/assets/composer/icon.svg +7 -0
- package/system/assets/console-logging/icon.svg +4 -0
- package/system/assets/core-blocks/icon.svg +6 -0
- package/system/assets/device-history/icon.svg +4 -0
- package/system/assets/device-manager/icon.svg +6 -0
- package/system/assets/filesystem-storage/icon.svg +6 -0
- package/system/assets/hub-forwarder/icon.svg +7 -0
- package/system/assets/keychain/icon.svg +6 -0
- package/system/assets/liveness-monitor/icon.svg +4 -0
- package/system/assets/local-auth/icon.svg +5 -0
- package/system/assets/local-network/icon.svg +7 -0
- package/system/assets/loki-logging/icon.svg +7 -0
- package/system/assets/metrics-native/icon.svg +3 -0
- package/system/assets/platform-probe/icon.svg +5 -0
- package/system/assets/record-entries/icon.svg +8 -0
- package/system/assets/remote-access-orchestrator/icon.svg +5 -0
- package/system/assets/snapshot/icon.svg +4 -0
- package/system/assets/sqlite-settings/icon.svg +5 -0
- package/system/assets/storage-orchestrator/icon.svg +8 -0
- package/system/assets/system-config/icon.svg +4 -0
- package/system/assets/winston-logging/icon.svg +6 -0
- package/system/dist/addon/addon-api-factory.d.ts +35 -0
- package/system/dist/addon-routes/addon-route-registry.d.ts +37 -0
- package/system/dist/addon-runner.js +11894 -0
- package/system/dist/addon-runner.mjs +11840 -0
- package/system/dist/addon-utils.d.ts +23 -0
- package/system/dist/addon-utils.js +27 -0
- package/system/dist/addon-utils.mjs +3 -0
- package/system/dist/agent-https-BMbnmX5u.mjs +1042 -0
- package/system/dist/agent-https-DslXCDRW.js +1289 -0
- package/system/dist/amd-accelerators-CEuPFBBK.js +36 -0
- package/system/dist/amd-accelerators-U_RsoEDd.mjs +35 -0
- package/system/dist/auth/auth-audit-log.d.ts +45 -0
- package/system/dist/auth/auth-manager.d.ts +155 -0
- package/system/dist/auth/cidr.d.ts +22 -0
- package/system/dist/auth/device-ca-store.d.ts +57 -0
- package/system/dist/auth/device-ca.d.ts +65 -0
- package/system/dist/auth/device-credential-manager.d.ts +158 -0
- package/system/dist/auth/external-identity-manager.d.ts +42 -0
- package/system/dist/auth/jwt-signing-key.d.ts +42 -0
- package/system/dist/auth/legacy-token-tables.d.ts +16 -0
- package/system/dist/auth/login-session-manager.d.ts +140 -0
- package/system/dist/auth/origin.d.ts +34 -0
- package/system/dist/auth/parse-record.d.ts +18 -0
- package/system/dist/auth/scope-matcher.d.ts +8 -0
- package/system/dist/auth/session-revocation-bus.d.ts +32 -0
- package/system/dist/auth/token-expiry.d.ts +62 -0
- package/system/dist/auth/totp-manager.d.ts +107 -0
- package/system/dist/auth/user-management-internal.d.ts +90 -0
- package/system/dist/auth/user-manager.d.ts +69 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +57 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +271 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +263 -0
- package/system/dist/builtins/addon-pages-aggregator/dedupe-pages.d.ts +24 -0
- package/system/dist/builtins/addon-pages-aggregator/index.d.ts +1 -0
- package/system/dist/builtins/addon-pages-aggregator/index.js +8 -0
- package/system/dist/builtins/addon-pages-aggregator/index.mjs +2 -0
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +57 -0
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +257 -0
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +249 -0
- package/system/dist/builtins/addon-widgets-aggregator/index.d.ts +1 -0
- package/system/dist/builtins/addon-widgets-aggregator/index.js +8 -0
- package/system/dist/builtins/addon-widgets-aggregator/index.mjs +2 -0
- package/system/dist/builtins/alerts/alert-episode-policy.d.ts +39 -0
- package/system/dist/builtins/alerts/alert-store.d.ts +32 -0
- package/system/dist/builtins/alerts/alerts.addon.d.ts +148 -0
- package/system/dist/builtins/alerts/alerts.addon.js +1566 -0
- package/system/dist/builtins/alerts/alerts.addon.mjs +1559 -0
- package/system/dist/builtins/alerts/device-label.d.ts +8 -0
- package/system/dist/builtins/alerts/emit-alert-policy.d.ts +15 -0
- package/system/dist/builtins/alerts/index.d.ts +1 -0
- package/system/dist/builtins/alerts/index.js +4 -0
- package/system/dist/builtins/alerts/index.mjs +2 -0
- package/system/dist/builtins/alerts/migration-alerts.d.ts +13 -0
- package/system/dist/builtins/alerts/prune-policy.d.ts +44 -0
- package/system/dist/builtins/alerts/record-kinds.d.ts +15 -0
- package/system/dist/builtins/alerts/runner-alert.d.ts +58 -0
- package/system/dist/builtins/autotrack/autotrack-cameras.d.ts +125 -0
- package/system/dist/builtins/autotrack/autotrack-config.d.ts +89 -0
- package/system/dist/builtins/autotrack/autotrack-decision.d.ts +86 -0
- package/system/dist/builtins/autotrack/autotrack-loop.d.ts +95 -0
- package/system/dist/builtins/autotrack/autotrack.addon.d.ts +108 -0
- package/system/dist/builtins/autotrack/frame-error.d.ts +50 -0
- package/system/dist/builtins/autotrack/frame-measurements.d.ts +97 -0
- package/system/dist/builtins/autotrack/index.d.ts +2 -0
- package/system/dist/builtins/autotrack/index.js +1018 -0
- package/system/dist/builtins/autotrack/index.mjs +1012 -0
- package/system/dist/builtins/autotrack/ptz-mirror.d.ts +54 -0
- package/system/dist/builtins/autotrack/target-selection.d.ts +46 -0
- package/system/dist/builtins/backup-orchestrator/backup-databases.d.ts +51 -0
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +291 -0
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +3213 -0
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +3204 -0
- package/system/dist/builtins/backup-orchestrator/cron-helpers.d.ts +23 -0
- package/system/dist/builtins/backup-orchestrator/destination-policy.d.ts +91 -0
- package/system/dist/builtins/backup-orchestrator/download-helpers.d.ts +12 -0
- package/system/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +49 -0
- package/system/dist/builtins/backup-orchestrator/index.d.ts +2 -0
- package/system/dist/builtins/backup-orchestrator/index.js +8 -0
- package/system/dist/builtins/backup-orchestrator/index.mjs +2 -0
- package/system/dist/builtins/backup-orchestrator/manifest-store.d.ts +134 -0
- package/system/dist/builtins/backup-orchestrator/record-kinds.d.ts +56 -0
- package/system/dist/builtins/backup-orchestrator/restore-archive.d.ts +24 -0
- package/system/dist/builtins/backup-orchestrator/run-queue.d.ts +106 -0
- package/system/dist/builtins/backup-orchestrator/schedule-store.d.ts +59 -0
- package/system/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +26 -0
- package/system/dist/builtins/backup-orchestrator/staging-paths.d.ts +36 -0
- package/system/dist/builtins/backup-orchestrator/write-targets.d.ts +63 -0
- package/system/dist/builtins/calendars/calendar-color.d.ts +9 -0
- package/system/dist/builtins/calendars/calendar-prefs-store.d.ts +34 -0
- package/system/dist/builtins/calendars/calendars.addon.d.ts +19 -0
- package/system/dist/builtins/calendars/calendars.addon.js +227 -0
- package/system/dist/builtins/calendars/calendars.addon.mjs +220 -0
- package/system/dist/builtins/calendars/index.d.ts +1 -0
- package/system/dist/builtins/calendars/index.js +8 -0
- package/system/dist/builtins/calendars/index.mjs +2 -0
- package/system/dist/builtins/calendars/record-kinds.d.ts +18 -0
- package/system/dist/builtins/camera-grid/acquire-retry.d.ts +30 -0
- package/system/dist/builtins/camera-grid/addon.d.ts +205 -0
- package/system/dist/builtins/camera-grid/flv-join.d.ts +40 -0
- package/system/dist/builtins/camera-grid/grid-activity-mirror.d.ts +42 -0
- package/system/dist/builtins/camera-grid/grid-activity.d.ts +91 -0
- package/system/dist/builtins/camera-grid/grid-camera-declarations.d.ts +59 -0
- package/system/dist/builtins/camera-grid/grid-camera-device.d.ts +68 -0
- package/system/dist/builtins/camera-grid/grid-canvas-derivation.d.ts +54 -0
- package/system/dist/builtins/camera-grid/grid-canvas-seed.d.ts +112 -0
- package/system/dist/builtins/camera-grid/grid-canvas.d.ts +85 -0
- package/system/dist/builtins/camera-grid/grid-child.d.ts +32 -0
- package/system/dist/builtins/camera-grid/grid-compositor-child.d.ts +3 -0
- package/system/dist/builtins/camera-grid/grid-compositor-invocation.d.ts +47 -0
- package/system/dist/builtins/camera-grid/grid-compositor.d.ts +54 -0
- package/system/dist/builtins/camera-grid/grid-detection-mapping.d.ts +61 -0
- package/system/dist/builtins/camera-grid/grid-device-settings.d.ts +35 -0
- package/system/dist/builtins/camera-grid/grid-filter-graph.d.ts +53 -0
- package/system/dist/builtins/camera-grid/grid-frame-sample.d.ts +53 -0
- package/system/dist/builtins/camera-grid/grid-instances.d.ts +22 -0
- package/system/dist/builtins/camera-grid/grid-last-frame-store.d.ts +58 -0
- package/system/dist/builtins/camera-grid/grid-layout-native-provider.d.ts +34 -0
- package/system/dist/builtins/camera-grid/grid-plan.d.ts +34 -0
- package/system/dist/builtins/camera-grid/grid-profiles.d.ts +104 -0
- package/system/dist/builtins/camera-grid/grid-row-normalization.d.ts +10 -0
- package/system/dist/builtins/camera-grid/grid-sentry-sources.d.ts +64 -0
- package/system/dist/builtins/camera-grid/grid-snapshot.d.ts +62 -0
- package/system/dist/builtins/camera-grid/grid-stream-descriptor.d.ts +53 -0
- package/system/dist/builtins/camera-grid/grid-stream-invocation.d.ts +44 -0
- package/system/dist/builtins/camera-grid/grid-stream-relay.d.ts +35 -0
- package/system/dist/builtins/camera-grid/grid-stream-session.d.ts +143 -0
- package/system/dist/builtins/camera-grid/grid-tile-feed.d.ts +50 -0
- package/system/dist/builtins/camera-grid/grid-tile-plan.d.ts +66 -0
- package/system/dist/builtins/camera-grid/grid-wire-format.d.ts +30 -0
- package/system/dist/builtins/camera-grid/index.d.ts +45 -0
- package/system/dist/builtins/camera-grid/index.js +3994 -0
- package/system/dist/builtins/camera-grid/index.mjs +3961 -0
- package/system/dist/builtins/camera-grid/silence-analysis.d.ts +37 -0
- package/system/dist/builtins/cluster-agent/record-kinds.d.ts +49 -0
- package/system/dist/builtins/composer/actuator-dispatch.d.ts +13 -0
- package/system/dist/builtins/composer/actuator-groups.d.ts +68 -0
- package/system/dist/builtins/composer/actuator-invoke.d.ts +32 -0
- package/system/dist/builtins/composer/claim-gate.d.ts +59 -0
- package/system/dist/builtins/composer/composed-device-set.d.ts +52 -0
- package/system/dist/builtins/composer/composed-device.d.ts +57 -0
- package/system/dist/builtins/composer/composer-apply-waits.d.ts +28 -0
- package/system/dist/builtins/composer/composer-grafts.d.ts +73 -0
- package/system/dist/builtins/composer/composer-live-set.d.ts +30 -0
- package/system/dist/builtins/composer/composer-plan.d.ts +112 -0
- package/system/dist/builtins/composer/composer-runtime-factory.d.ts +30 -0
- package/system/dist/builtins/composer/composer-seeds.d.ts +28 -0
- package/system/dist/builtins/composer/composer-verdict.d.ts +33 -0
- package/system/dist/builtins/composer/composer.addon.d.ts +26 -0
- package/system/dist/builtins/composer/composer.addon.js +6229 -0
- package/system/dist/builtins/composer/composer.addon.mjs +6223 -0
- package/system/dist/builtins/composer/composer.d.ts +208 -0
- package/system/dist/builtins/composer/composition-declarations.d.ts +64 -0
- package/system/dist/builtins/composer/composition-evaluation.d.ts +53 -0
- package/system/dist/builtins/composer/composition-runtime.d.ts +203 -0
- package/system/dist/builtins/composer/composition-target.d.ts +60 -0
- package/system/dist/builtins/composer/confirmed-seed.d.ts +44 -0
- package/system/dist/builtins/composer/deadline-timer.d.ts +18 -0
- package/system/dist/builtins/composer/existing-target.d.ts +131 -0
- package/system/dist/builtins/composer/field-record.d.ts +64 -0
- package/system/dist/builtins/composer/forward-commands.d.ts +61 -0
- package/system/dist/builtins/composer/graft-host.d.ts +71 -0
- package/system/dist/builtins/composer/held-claims.d.ts +29 -0
- package/system/dist/builtins/composer/history-helpers.d.ts +67 -0
- package/system/dist/builtins/composer/index.d.ts +1 -0
- package/system/dist/builtins/composer/index.js +8 -0
- package/system/dist/builtins/composer/index.mjs +2 -0
- package/system/dist/builtins/composer/math-quantity.d.ts +20 -0
- package/system/dist/builtins/composer/own-field-reads.d.ts +30 -0
- package/system/dist/builtins/composer/owned-fields-target.d.ts +95 -0
- package/system/dist/builtins/composer/pulse-seed-resolve.d.ts +59 -0
- package/system/dist/builtins/composer/pulse-seed.d.ts +75 -0
- package/system/dist/builtins/composer/slice-assembler.d.ts +26 -0
- package/system/dist/builtins/composer/source-readings.d.ts +128 -0
- package/system/dist/builtins/composer/source-tracker.d.ts +135 -0
- package/system/dist/builtins/console-logging/console-destination.d.ts +19 -0
- package/system/dist/builtins/console-logging/console-logging.addon.d.ts +26 -0
- package/system/dist/builtins/console-logging/index.d.ts +3 -0
- package/system/dist/builtins/console-logging/index.js +108 -0
- package/system/dist/builtins/console-logging/index.mjs +99 -0
- package/system/dist/builtins/core-blocks/actions-service.d.ts +113 -0
- package/system/dist/builtins/core-blocks/actions-store.d.ts +32 -0
- package/system/dist/builtins/core-blocks/actions-wiring.d.ts +32 -0
- package/system/dist/builtins/core-blocks/block-package.d.ts +54 -0
- package/system/dist/builtins/core-blocks/block-settings-store.d.ts +93 -0
- package/system/dist/builtins/core-blocks/block-supervisor.d.ts +176 -0
- package/system/dist/builtins/core-blocks/block-type-defs.d.ts +29 -0
- package/system/dist/builtins/core-blocks/blocks-integration.d.ts +89 -0
- package/system/dist/builtins/core-blocks/compile-block.d.ts +52 -0
- package/system/dist/builtins/core-blocks/composition-api.d.ts +50 -0
- package/system/dist/builtins/core-blocks/composition-peers.d.ts +31 -0
- package/system/dist/builtins/core-blocks/composition-sources.d.ts +40 -0
- package/system/dist/builtins/core-blocks/core-block-store.d.ts +120 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +108 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +6374 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +6355 -0
- package/system/dist/builtins/core-blocks/extract-settings-schema.d.ts +6 -0
- package/system/dist/builtins/core-blocks/index.d.ts +8 -0
- package/system/dist/builtins/core-blocks/index.js +21 -0
- package/system/dist/builtins/core-blocks/index.mjs +2 -0
- package/system/dist/builtins/core-blocks/lock-door-gate.d.ts +31 -0
- package/system/dist/builtins/core-blocks/lock-door-sensor.d.ts +35 -0
- package/system/dist/builtins/core-blocks/power-source-service.d.ts +70 -0
- package/system/dist/builtins/core-blocks/record-kinds.d.ts +83 -0
- package/system/dist/builtins/core-blocks/remote-call-redirect.d.ts +23 -0
- package/system/dist/builtins/core-blocks/remote-components-service.d.ts +10 -0
- package/system/dist/builtins/core-blocks/remote-service.d.ts +85 -0
- package/system/dist/builtins/core-blocks/remote-wiring.d.ts +49 -0
- package/system/dist/builtins/core-blocks/runs-api.d.ts +30 -0
- package/system/dist/builtins/core-blocks/runs-ledger.d.ts +64 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-engine.d.ts +91 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-holds.d.ts +54 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-service.d.ts +76 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +23 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-timeline.d.ts +53 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-trace.d.ts +17 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-types.d.ts +20 -0
- package/system/dist/builtins/core-blocks/scheduler/scheduler-wiring.d.ts +41 -0
- package/system/dist/builtins/core-blocks/templates-service.d.ts +24 -0
- package/system/dist/builtins/device-history/capture/capture-engine.d.ts +113 -0
- package/system/dist/builtins/device-history/capture/capture-filter.d.ts +37 -0
- package/system/dist/builtins/device-history/capture/device-directory.d.ts +47 -0
- package/system/dist/builtins/device-history/capture/field-path.d.ts +10 -0
- package/system/dist/builtins/device-history/capture/point-writer.d.ts +63 -0
- package/system/dist/builtins/device-history/device-history.addon.d.ts +53 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2885 -0
- package/system/dist/builtins/device-history/device-history.addon.mjs +2878 -0
- package/system/dist/builtins/device-history/index.d.ts +3 -0
- package/system/dist/builtins/device-history/ingest/producer-ingest.d.ts +99 -0
- package/system/dist/builtins/device-history/query/history-query.d.ts +116 -0
- package/system/dist/builtins/device-history/query/point-shape.d.ts +31 -0
- package/system/dist/builtins/device-history/retention/departure-tracker.d.ts +33 -0
- package/system/dist/builtins/device-history/retention/orphans.d.ts +50 -0
- package/system/dist/builtins/device-history/retention/retention.d.ts +74 -0
- package/system/dist/builtins/device-history/rollup/rollup-engine.d.ts +74 -0
- package/system/dist/builtins/device-history/rollup/rollup-math.d.ts +50 -0
- package/system/dist/builtins/device-history/runtime/history-runtime.d.ts +118 -0
- package/system/dist/builtins/device-history/status/counters.d.ts +55 -0
- package/system/dist/builtins/device-history/store/history-door.d.ts +7 -0
- package/system/dist/builtins/device-history/store/history-schema.d.ts +28 -0
- package/system/dist/builtins/device-history/store/history-store.d.ts +109 -0
- package/system/dist/builtins/device-history/store/row-readers.d.ts +11 -0
- package/system/dist/builtins/device-history/store/series-registry.d.ts +64 -0
- package/system/dist/builtins/device-history/store/series-scale.d.ts +37 -0
- package/system/dist/builtins/device-history/time/bucket-time.d.ts +25 -0
- package/system/dist/builtins/device-manager/adoption-job-engine.d.ts +153 -0
- package/system/dist/builtins/device-manager/claimed-status-overlay.d.ts +45 -0
- package/system/dist/builtins/device-manager/contribution-cache.d.ts +85 -0
- package/system/dist/builtins/device-manager/day-night-config-schema.d.ts +30 -0
- package/system/dist/builtins/device-manager/device-aggregation-merge.d.ts +22 -0
- package/system/dist/builtins/device-manager/device-aggregation.d.ts +335 -0
- package/system/dist/builtins/device-manager/device-bindings-store.d.ts +278 -0
- package/system/dist/builtins/device-manager/device-config-contribution.d.ts +45 -0
- package/system/dist/builtins/device-manager/device-config-secrets.d.ts +40 -0
- package/system/dist/builtins/device-manager/device-event-propagator.d.ts +26 -0
- package/system/dist/builtins/device-manager/device-extension-linked-slot.d.ts +27 -0
- package/system/dist/builtins/device-manager/device-form-secrets.d.ts +25 -0
- package/system/dist/builtins/device-manager/device-linked-devices.d.ts +201 -0
- package/system/dist/builtins/device-manager/device-manager.addon.d.ts +234 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +11369 -0
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +11358 -0
- package/system/dist/builtins/device-manager/device-meta-actions.d.ts +338 -0
- package/system/dist/builtins/device-manager/device-meta-store.d.ts +103 -0
- package/system/dist/builtins/device-manager/device-meta-types.d.ts +277 -0
- package/system/dist/builtins/device-manager/device-online-fallback.d.ts +35 -0
- package/system/dist/builtins/device-manager/device-projection.d.ts +71 -0
- package/system/dist/builtins/device-manager/device-provider-context.d.ts +126 -0
- package/system/dist/builtins/device-manager/device-queries.d.ts +67 -0
- package/system/dist/builtins/device-manager/device-removal-hooks.d.ts +92 -0
- package/system/dist/builtins/device-manager/device-row-store.d.ts +449 -0
- package/system/dist/builtins/device-manager/device-source-activation.d.ts +103 -0
- package/system/dist/builtins/device-manager/device-state-claim-views.d.ts +92 -0
- package/system/dist/builtins/device-manager/device-state-claims.d.ts +66 -0
- package/system/dist/builtins/device-manager/device-state-mirror.d.ts +267 -0
- package/system/dist/builtins/device-manager/device-sync-resolvers.d.ts +30 -0
- package/system/dist/builtins/device-manager/device-tombstone-store.d.ts +29 -0
- package/system/dist/builtins/device-manager/discovery-orchestrator.d.ts +45 -0
- package/system/dist/builtins/device-manager/field-claims-index.d.ts +96 -0
- package/system/dist/builtins/device-manager/field-ownership.d.ts +71 -0
- package/system/dist/builtins/device-manager/fleet-read-census.d.ts +104 -0
- package/system/dist/builtins/device-manager/image-settings-config-schema.d.ts +22 -0
- package/system/dist/builtins/device-manager/index.d.ts +2 -0
- package/system/dist/builtins/device-manager/index.js +8 -0
- package/system/dist/builtins/device-manager/index.mjs +2 -0
- package/system/dist/builtins/device-manager/linked-devices-manual-backfill.d.ts +27 -0
- package/system/dist/builtins/device-manager/location-alignment.d.ts +61 -0
- package/system/dist/builtins/device-manager/migrate-device.d.ts +192 -0
- package/system/dist/builtins/device-manager/migrate-guard.d.ts +78 -0
- package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +79 -0
- package/system/dist/builtins/device-manager/migrate-reload.d.ts +46 -0
- package/system/dist/builtins/device-manager/migration-refused.d.ts +23 -0
- package/system/dist/builtins/device-manager/mirror-row-writer.d.ts +222 -0
- package/system/dist/builtins/device-manager/record-kinds.d.ts +14 -0
- package/system/dist/builtins/device-manager/recording-onboard-config-schema.d.ts +65 -0
- package/system/dist/builtins/device-manager/removal-cleanup.d.ts +50 -0
- package/system/dist/builtins/device-manager/removal-fence.d.ts +58 -0
- package/system/dist/builtins/device-manager/running-flip.d.ts +11 -0
- package/system/dist/builtins/device-manager/runtime-state-persist-gate.d.ts +64 -0
- package/system/dist/builtins/device-manager/secret-config-paths.d.ts +24 -0
- package/system/dist/builtins/device-manager/stale-wrapper-activations.d.ts +59 -0
- package/system/dist/builtins/device-manager/write-lock.d.ts +17 -0
- package/system/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +43 -0
- package/system/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +16 -0
- package/system/dist/builtins/hub-forwarder/index.d.ts +3 -0
- package/system/dist/builtins/hub-forwarder/index.js +151 -0
- package/system/dist/builtins/hub-forwarder/index.mjs +142 -0
- package/system/dist/builtins/keychain/index.d.ts +1 -0
- package/system/dist/builtins/keychain/index.js +2059 -0
- package/system/dist/builtins/keychain/index.mjs +2052 -0
- package/system/dist/builtins/keychain/key-sources.d.ts +37 -0
- package/system/dist/builtins/keychain/keychain-crypto.d.ts +28 -0
- package/system/dist/builtins/keychain/keychain-reset-trigger.d.ts +25 -0
- package/system/dist/builtins/keychain/keychain-service.d.ts +180 -0
- package/system/dist/builtins/keychain/keychain-store.d.ts +125 -0
- package/system/dist/builtins/keychain/keychain-usage.d.ts +17 -0
- package/system/dist/builtins/keychain/keychain.addon.d.ts +36 -0
- package/system/dist/builtins/keychain/platform-key-source.d.ts +24 -0
- package/system/dist/builtins/keychain/record-kinds.d.ts +16 -0
- package/system/dist/builtins/keychain/system-held-secrets.d.ts +25 -0
- package/system/dist/builtins/liveness-monitor/index.d.ts +2 -0
- package/system/dist/builtins/liveness-monitor/index.js +6 -0
- package/system/dist/builtins/liveness-monitor/index.mjs +2 -0
- package/system/dist/builtins/liveness-monitor/liveness-checks.d.ts +85 -0
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.d.ts +46 -0
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +443 -0
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +437 -0
- package/system/dist/builtins/liveness-monitor/liveness-reporter.d.ts +28 -0
- package/system/dist/builtins/liveness-monitor/storage-root-access.d.ts +53 -0
- package/system/dist/builtins/local-auth/admin-account-boot.d.ts +27 -0
- package/system/dist/builtins/local-auth/auth-config-reader.d.ts +39 -0
- package/system/dist/builtins/local-auth/auth-schema.d.ts +93 -0
- package/system/dist/builtins/local-auth/index.d.ts +1 -0
- package/system/dist/builtins/local-auth/index.js +4 -0
- package/system/dist/builtins/local-auth/index.mjs +2 -0
- package/system/dist/builtins/local-auth/jwt-signing-key-keeper.d.ts +30 -0
- package/system/dist/builtins/local-auth/local-auth.addon.d.ts +48 -0
- package/system/dist/builtins/local-auth/local-auth.addon.js +12418 -0
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +12388 -0
- package/system/dist/builtins/local-auth/oauth-grants.d.ts +71 -0
- package/system/dist/builtins/local-auth/oauth-session-manager.d.ts +44 -0
- package/system/dist/builtins/local-auth/person-scopes.d.ts +7 -0
- package/system/dist/builtins/local-auth/preferences-record-kinds.d.ts +27 -0
- package/system/dist/builtins/local-auth/record-kinds.d.ts +137 -0
- package/system/dist/builtins/local-auth/user-preferences-store.d.ts +56 -0
- package/system/dist/builtins/local-network/address-book.d.ts +128 -0
- package/system/dist/builtins/local-network/agent-mdns.d.ts +56 -0
- package/system/dist/builtins/local-network/hub-mdns-ciao.d.ts +7 -0
- package/system/dist/builtins/local-network/hub-mdns.d.ts +58 -0
- package/system/dist/builtins/local-network/index.d.ts +1 -0
- package/system/dist/builtins/local-network/index.js +10 -0
- package/system/dist/builtins/local-network/index.mjs +2 -0
- package/system/dist/builtins/local-network/ipv6-lan.d.ts +21 -0
- package/system/dist/builtins/local-network/local-hostname.d.ts +15 -0
- package/system/dist/builtins/local-network/local-network.addon.d.ts +334 -0
- package/system/dist/builtins/local-network/local-network.addon.js +2487 -0
- package/system/dist/builtins/local-network/local-network.addon.mjs +2466 -0
- package/system/dist/builtins/local-network/scan/dns-wire.d.ts +17 -0
- package/system/dist/builtins/local-network/scan/scan-engine.d.ts +31 -0
- package/system/dist/builtins/local-network/scan/scan-io-node.d.ts +2 -0
- package/system/dist/builtins/local-network/scan/scan-io.d.ts +56 -0
- package/system/dist/builtins/local-network/scan/subnets.d.ts +57 -0
- package/system/dist/builtins/loki-logging/index.d.ts +4 -0
- package/system/dist/builtins/loki-logging/index.js +915 -0
- package/system/dist/builtins/loki-logging/index.mjs +901 -0
- package/system/dist/builtins/loki-logging/loki-destination.d.ts +142 -0
- package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +66 -0
- package/system/dist/builtins/loki-logging/loki-payload.d.ts +100 -0
- package/system/dist/builtins/loki-logging/loki-read.d.ts +51 -0
- package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +48 -0
- package/system/dist/builtins/native-metrics/cgroup-memory.d.ts +240 -0
- package/system/dist/builtins/native-metrics/cgroup-pids.d.ts +159 -0
- package/system/dist/builtins/native-metrics/container-memory-ring.d.ts +18 -0
- package/system/dist/builtins/native-metrics/darwin-memory.d.ts +26 -0
- package/system/dist/builtins/native-metrics/gpu-probe.d.ts +18 -0
- package/system/dist/builtins/native-metrics/index.d.ts +2 -0
- package/system/dist/builtins/native-metrics/load-series-config.d.ts +83 -0
- package/system/dist/builtins/native-metrics/load-series-reader.d.ts +63 -0
- package/system/dist/builtins/native-metrics/load-series-types.d.ts +14 -0
- package/system/dist/builtins/native-metrics/native-metrics-provider.d.ts +49 -0
- package/system/dist/builtins/native-metrics/native-metrics.addon.d.ts +233 -0
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +3116 -0
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +3106 -0
- package/system/dist/builtins/native-metrics/node-load-ring.d.ts +212 -0
- package/system/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +155 -0
- package/system/dist/builtins/native-metrics/proc-process-table.d.ts +25 -0
- package/system/dist/builtins/native-metrics/process-classification.d.ts +110 -0
- package/system/dist/builtins/native-metrics/thread-cpu-sampler.d.ts +116 -0
- package/system/dist/builtins/platform-probe/accelerator-facts-probe.d.ts +24 -0
- package/system/dist/builtins/platform-probe/accelerator-reprobe.d.ts +23 -0
- package/system/dist/builtins/platform-probe/amd-accelerators.d.ts +15 -0
- package/system/dist/builtins/platform-probe/amd-npu.d.ts +35 -0
- package/system/dist/builtins/platform-probe/coral-accelerators.d.ts +87 -0
- package/system/dist/builtins/platform-probe/index.d.ts +57 -0
- package/system/dist/builtins/platform-probe/index.js +1151 -0
- package/system/dist/builtins/platform-probe/index.mjs +1140 -0
- package/system/dist/builtins/platform-probe/inference-config-resolver.d.ts +29 -0
- package/system/dist/builtins/platform-probe/intel-accelerators.d.ts +14 -0
- package/system/dist/builtins/platform-probe/intel-npu.d.ts +38 -0
- package/system/dist/builtins/platform-probe/platform-scorer.d.ts +66 -0
- package/system/dist/builtins/platform-probe/runtime-packages.d.ts +6 -0
- package/system/dist/builtins/platform-probe/windows-hardware.d.ts +77 -0
- package/system/dist/builtins/record-entries/entries-service.d.ts +42 -0
- package/system/dist/builtins/record-entries/index.d.ts +1 -0
- package/system/dist/builtins/record-entries/index.js +162 -0
- package/system/dist/builtins/record-entries/index.mjs +156 -0
- package/system/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
- package/system/dist/builtins/records-isolated.d.ts +10 -0
- package/system/dist/builtins/remote-access-orchestrator/enabled-providers-reconcile.d.ts +96 -0
- package/system/dist/builtins/remote-access-orchestrator/index.d.ts +1 -0
- package/system/dist/builtins/remote-access-orchestrator/index.js +8 -0
- package/system/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +71 -0
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +214 -0
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +208 -0
- package/system/dist/builtins/shared/device-state-changed.d.ts +16 -0
- package/system/dist/builtins/shared/settle-sources.d.ts +22 -0
- package/system/dist/builtins/snapshot/index.d.ts +2 -0
- package/system/dist/builtins/snapshot/index.js +2720 -0
- package/system/dist/builtins/snapshot/index.mjs +2713 -0
- package/system/dist/builtins/snapshot/snapshot-cache.d.ts +108 -0
- package/system/dist/builtins/snapshot/snapshot-coalescing.d.ts +135 -0
- package/system/dist/builtins/snapshot/snapshot-courtesy.d.ts +68 -0
- package/system/dist/builtins/snapshot/snapshot-durable-store.d.ts +36 -0
- package/system/dist/builtins/snapshot/snapshot-fatigue.d.ts +41 -0
- package/system/dist/builtins/snapshot/snapshot-grab-pick.d.ts +20 -0
- package/system/dist/builtins/snapshot/snapshot-link-url.d.ts +66 -0
- package/system/dist/builtins/snapshot/snapshot-media-handler.d.ts +121 -0
- package/system/dist/builtins/snapshot/snapshot-resize.d.ts +75 -0
- package/system/dist/builtins/snapshot/snapshot.addon.d.ts +581 -0
- package/system/dist/builtins/sqlite-storage/analyze-stats.d.ts +83 -0
- package/system/dist/builtins/sqlite-storage/config-store.d.ts +8 -0
- package/system/dist/builtins/sqlite-storage/database-snapshot-provider.d.ts +18 -0
- package/system/dist/builtins/sqlite-storage/device-store.d.ts +23 -0
- package/system/dist/builtins/sqlite-storage/file-host-client.d.ts +75 -0
- package/system/dist/builtins/sqlite-storage/file-host-handlers.d.ts +27 -0
- package/system/dist/builtins/sqlite-storage/file-host-protocol.d.ts +167 -0
- package/system/dist/builtins/sqlite-storage/file-host-worker.d.ts +1 -0
- package/system/dist/builtins/sqlite-storage/filesystem-browse-provider.d.ts +25 -0
- package/system/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +83 -0
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +33 -0
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +419 -0
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +411 -0
- package/system/dist/builtins/sqlite-storage/filter-compiler.d.ts +126 -0
- package/system/dist/builtins/sqlite-storage/index.d.ts +12 -0
- package/system/dist/builtins/sqlite-storage/index.js +82 -0
- package/system/dist/builtins/sqlite-storage/index.mjs +50 -0
- package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +31 -0
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +34 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-actions.d.ts +12 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-edits.d.ts +35 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +125 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-hold.d.ts +23 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-pass.d.ts +48 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-restore-marker.d.ts +3 -0
- package/system/dist/builtins/sqlite-storage/migrations/migration-types.d.ts +151 -0
- package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +61 -0
- package/system/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +173 -0
- package/system/dist/builtins/sqlite-storage/path-guard.d.ts +11 -0
- package/system/dist/builtins/sqlite-storage/placement-errors.d.ts +60 -0
- package/system/dist/builtins/sqlite-storage/placement-router.d.ts +85 -0
- package/system/dist/builtins/sqlite-storage/prefix-range.d.ts +50 -0
- package/system/dist/builtins/sqlite-storage/query-bounds.d.ts +110 -0
- package/system/dist/builtins/sqlite-storage/query-profiler.d.ts +242 -0
- package/system/dist/builtins/sqlite-storage/records/records-catalog.d.ts +27 -0
- package/system/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +48 -0
- package/system/dist/builtins/sqlite-storage/records/records-engine.d.ts +115 -0
- package/system/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
- package/system/dist/builtins/sqlite-storage/records/records-plan.d.ts +95 -0
- package/system/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
- package/system/dist/builtins/sqlite-storage/records/records-provider.d.ts +72 -0
- package/system/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
- package/system/dist/builtins/sqlite-storage/records/records-sql.d.ts +39 -0
- package/system/dist/builtins/sqlite-storage/retired-settings-keys.d.ts +276 -0
- package/system/dist/builtins/sqlite-storage/shm-lock-canary.d.ts +60 -0
- package/system/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +191 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +583 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +52 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2960 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2952 -0
- package/system/dist/builtins/sqlite-storage/sqlite-snapshot-protocol.d.ts +54 -0
- package/system/dist/builtins/sqlite-storage/sqlite-snapshot-worker.d.ts +33 -0
- package/system/dist/builtins/sqlite-storage/sqlite-snapshotter.d.ts +118 -0
- package/system/dist/builtins/sqlite-storage/stale-data/stale-data-audit.d.ts +81 -0
- package/system/dist/builtins/sqlite-storage/stale-data/stale-data-ports.d.ts +17 -0
- package/system/dist/builtins/sqlite-storage/statement-shape.d.ts +64 -0
- package/system/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +33 -0
- package/system/dist/builtins/sqlite-storage/table-sizes.d.ts +95 -0
- package/system/dist/builtins/sqlite-storage/vector-index-shared.d.ts +81 -0
- package/system/dist/builtins/sqlite-storage/vector-index-vec.d.ts +143 -0
- package/system/dist/builtins/sqlite-storage/vector-provider.d.ts +30 -0
- package/system/dist/builtins/sqlite-storage/wal-checkpoint-policy.d.ts +196 -0
- package/system/dist/builtins/sqlite-storage/wal-checkpoint-worker.d.ts +1 -0
- package/system/dist/builtins/sqlite-storage/wal-checkpointer.d.ts +76 -0
- package/system/dist/builtins/sqlite-storage/wal-maintenance.d.ts +130 -0
- package/system/dist/builtins/storage-orchestrator/access-guards.d.ts +43 -0
- package/system/dist/builtins/storage-orchestrator/data-store-dispatch.d.ts +39 -0
- package/system/dist/builtins/storage-orchestrator/drain-ratchet.d.ts +104 -0
- package/system/dist/builtins/storage-orchestrator/drain-state-store.d.ts +26 -0
- package/system/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +128 -0
- package/system/dist/builtins/storage-orchestrator/index.d.ts +7 -0
- package/system/dist/builtins/storage-orchestrator/index.js +11 -0
- package/system/dist/builtins/storage-orchestrator/index.mjs +2 -0
- package/system/dist/builtins/storage-orchestrator/location-class-paths.d.ts +13 -0
- package/system/dist/builtins/storage-orchestrator/location-history-recorder.d.ts +76 -0
- package/system/dist/builtins/storage-orchestrator/location-occupancy-slice.d.ts +71 -0
- package/system/dist/builtins/storage-orchestrator/location-occupancy.d.ts +19 -0
- package/system/dist/builtins/storage-orchestrator/location-protection.d.ts +20 -0
- package/system/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +57 -0
- package/system/dist/builtins/storage-orchestrator/location-repointer.d.ts +97 -0
- package/system/dist/builtins/storage-orchestrator/location-root-collision.d.ts +80 -0
- package/system/dist/builtins/storage-orchestrator/location-secrets.d.ts +114 -0
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +82 -0
- package/system/dist/builtins/storage-orchestrator/location-volume-capacity.d.ts +58 -0
- package/system/dist/builtins/storage-orchestrator/provider-discovery.d.ts +24 -0
- package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +43 -0
- package/system/dist/builtins/storage-orchestrator/storage-cleanup-coordinator.d.ts +68 -0
- package/system/dist/builtins/storage-orchestrator/storage-location-band-monitor.d.ts +77 -0
- package/system/dist/builtins/storage-orchestrator/storage-migration-coordinator.d.ts +241 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +318 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +5280 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +5264 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +475 -0
- package/system/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +115 -0
- package/system/dist/builtins/system-backup/backup-encryption.d.ts +94 -0
- package/system/dist/builtins/system-backup/system-backup.service.d.ts +308 -0
- package/system/dist/builtins/system-config/index.d.ts +2 -0
- package/system/dist/builtins/system-config/index.js +10 -0
- package/system/dist/builtins/system-config/index.mjs +2 -0
- package/system/dist/builtins/system-config/mesh-actions.d.ts +3 -0
- package/system/dist/builtins/system-config/record-kinds.d.ts +32 -0
- package/system/dist/builtins/system-config/system-config.addon.d.ts +56 -0
- package/system/dist/builtins/system-config/system-config.addon.js +89334 -0
- package/system/dist/builtins/system-config/system-config.addon.mjs +89233 -0
- package/system/dist/builtins/winston-logging/index.d.ts +3 -0
- package/system/dist/builtins/winston-logging/index.js +324 -0
- package/system/dist/builtins/winston-logging/index.mjs +313 -0
- package/system/dist/builtins/winston-logging/log-file-cursor.d.ts +12 -0
- package/system/dist/builtins/winston-logging/log-file-index-store.d.ts +11 -0
- package/system/dist/builtins/winston-logging/log-file-index.d.ts +77 -0
- package/system/dist/builtins/winston-logging/log-file-read-client.d.ts +44 -0
- package/system/dist/builtins/winston-logging/log-file-read-protocol.d.ts +41 -0
- package/system/dist/builtins/winston-logging/log-file-read-worker.d.ts +1 -0
- package/system/dist/builtins/winston-logging/log-file-reader.d.ts +51 -0
- package/system/dist/builtins/winston-logging/winston-destination.d.ts +39 -0
- package/system/dist/builtins/winston-logging/winston-logging.addon.d.ts +20 -0
- package/system/dist/chunk-CNf5ZN-e.mjs +37 -0
- package/system/dist/chunk-Cek0wNdY.js +64 -0
- package/system/dist/composition-sources-C14epb_m.js +155 -0
- package/system/dist/composition-sources-EXNuxmGQ.mjs +132 -0
- package/system/dist/constants-DIGWBiNC.mjs +20 -0
- package/system/dist/constants-M7NtSiRo.js +66 -0
- package/system/dist/coral-accelerators-BSVsBVzt.js +250 -0
- package/system/dist/coral-accelerators-DBlgWB8k.mjs +231 -0
- package/system/dist/custom-action-registry-JuMHGKEc.js +1638 -0
- package/system/dist/custom-action-registry-oHl1xltx.mjs +1482 -0
- package/system/dist/device-ca-3vmBP1i0.js +474 -0
- package/system/dist/device-ca-DZlvNBWU.mjs +367 -0
- package/system/dist/dist-DcMqHB_N.mjs +108095 -0
- package/system/dist/dist-M9yHiIY7.js +110554 -0
- package/system/dist/download/hosted-model-revisions.d.ts +10 -0
- package/system/dist/download/model-download-service.d.ts +35 -0
- package/system/dist/download/model-downloader.d.ts +156 -0
- package/system/dist/events/event-bus.d.ts +10 -0
- package/system/dist/events/system-event-bus.d.ts +14 -0
- package/system/dist/feature/feature-manager.d.ts +11 -0
- package/system/dist/file-host-worker.js +160 -0
- package/system/dist/file-host-worker.mjs +160 -0
- package/system/dist/formatter-DkYZ4LXp.mjs +162 -0
- package/system/dist/formatter-xbxeV4GD.js +167 -0
- package/system/dist/framework-resolver-hook.mjs +49 -0
- package/system/dist/http/asset-compression.d.ts +55 -0
- package/system/dist/http/authenticated-file-server.d.ts +53 -0
- package/system/dist/http/data-plane-registry.d.ts +58 -0
- package/system/dist/http/file-data-plane.d.ts +18 -0
- package/system/dist/http/lan-http-bind.d.ts +41 -0
- package/system/dist/http/reverse-proxy.d.ts +42 -0
- package/system/dist/hub-mdns-ciao-CpCKuQnK.js +1163 -0
- package/system/dist/hub-mdns-ciao-Czz2ssit.mjs +942 -0
- package/system/dist/i18n/catalog-registry.d.ts +35 -0
- package/system/dist/i18n/index.d.ts +2 -0
- package/system/dist/index.d.ts +156 -0
- package/system/dist/index.js +28736 -0
- package/system/dist/index.mjs +28065 -0
- package/system/dist/intel-accelerators-BvBjZn4j.js +16 -0
- package/system/dist/intel-accelerators-idEumqk1.mjs +15 -0
- package/system/dist/intel-npu-C8HKvRQF.mjs +27 -0
- package/system/dist/intel-npu-DYF5hO5K.js +28 -0
- package/system/dist/kernel/addon-class-resolver.d.ts +4 -0
- package/system/dist/kernel/addon-engine-manager.d.ts +22 -0
- package/system/dist/kernel/addon-health-monitor.d.ts +163 -0
- package/system/dist/kernel/addon-installer.d.ts +651 -0
- package/system/dist/kernel/addon-loader.d.ts +144 -0
- package/system/dist/kernel/addon-manifest.d.ts +128 -0
- package/system/dist/kernel/addon-refused-error.d.ts +30 -0
- package/system/dist/kernel/addon-residue.d.ts +45 -0
- package/system/dist/kernel/addon-settings-store.d.ts +43 -0
- package/system/dist/kernel/addon-version-policy.d.ts +34 -0
- package/system/dist/kernel/anon-rss.d.ts +12 -0
- package/system/dist/kernel/array-buffer-census.d.ts +118 -0
- package/system/dist/kernel/bootstrap-config.d.ts +7 -0
- package/system/dist/kernel/cap-router-builder.d.ts +180 -0
- package/system/dist/kernel/capability-handle.d.ts +46 -0
- package/system/dist/kernel/capability-registry.d.ts +621 -0
- package/system/dist/kernel/config-manager.d.ts +174 -0
- package/system/dist/kernel/config-schema.d.ts +37 -0
- package/system/dist/kernel/custom-action-registry.d.ts +32 -0
- package/system/dist/kernel/deps/addon-deps-manager.d.ts +28 -0
- package/system/dist/kernel/deps/closure-dedupe.d.ts +105 -0
- package/system/dist/kernel/deps/ensure-addon-natives.d.ts +41 -0
- package/system/dist/kernel/deps/ensure-native-prebuilds.d.ts +40 -0
- package/system/dist/kernel/deps/manifest-native-deps.d.ts +42 -0
- package/system/dist/kernel/deps/manifest-python-deps.d.ts +20 -0
- package/system/dist/kernel/deps/manifest-system-deps.d.ts +18 -0
- package/system/dist/kernel/deps/npm-command.d.ts +60 -0
- package/system/dist/kernel/deps/system-package-allowlist.d.ts +12 -0
- package/system/dist/kernel/deps/system-package-broker.d.ts +31 -0
- package/system/dist/kernel/deps/system-package-client.d.ts +9 -0
- package/system/dist/kernel/device-call-redirect.d.ts +18 -0
- package/system/dist/kernel/device-registry.d.ts +29 -0
- package/system/dist/kernel/device-settings-store.d.ts +74 -0
- package/system/dist/kernel/event-loop-stall-monitor.d.ts +41 -0
- package/system/dist/kernel/event-plane-report.d.ts +225 -0
- package/system/dist/kernel/fs-utils.d.ts +88 -0
- package/system/dist/kernel/gc-census.d.ts +161 -0
- package/system/dist/kernel/heap-spaces.d.ts +112 -0
- package/system/dist/kernel/heap-watch.d.ts +816 -0
- package/system/dist/kernel/host-externals.d.ts +12 -0
- package/system/dist/kernel/hwaccel/hwaccel-resolver.d.ts +56 -0
- package/system/dist/kernel/hwaccel/vaapi-init-probe.d.ts +29 -0
- package/system/dist/kernel/index.d.ts +116 -0
- package/system/dist/kernel/inference/inference-resolver.d.ts +22 -0
- package/system/dist/kernel/inference/local-python-runtimes.d.ts +2 -0
- package/system/dist/kernel/infra-capabilities.d.ts +13 -0
- package/system/dist/kernel/isolated-builtin-phase.d.ts +57 -0
- package/system/dist/kernel/lifecycle/job-journal.d.ts +19 -0
- package/system/dist/kernel/lifecycle/lifecycle-job-engine.d.ts +106 -0
- package/system/dist/kernel/lifecycle/staging-area.d.ts +31 -0
- package/system/dist/kernel/moleculer/accessory-prune-gate.d.ts +55 -0
- package/system/dist/kernel/moleculer/addon-context-factory.d.ts +104 -0
- package/system/dist/kernel/moleculer/addon-data-plane-facility.d.ts +19 -0
- package/system/dist/kernel/moleculer/addon-deploy-source.d.ts +16 -0
- package/system/dist/kernel/moleculer/addon-peer-bytes-facility.d.ts +25 -0
- package/system/dist/kernel/moleculer/addon-runner.d.ts +1 -0
- package/system/dist/kernel/moleculer/addon-service-factory.d.ts +50 -0
- package/system/dist/kernel/moleculer/agent-event-scope.d.ts +49 -0
- package/system/dist/kernel/moleculer/agent-ui-unlock.d.ts +67 -0
- package/system/dist/kernel/moleculer/broker-factory.d.ts +95 -0
- package/system/dist/kernel/moleculer/broker-transport-swap.d.ts +60 -0
- package/system/dist/kernel/moleculer/cap-usage-registry.d.ts +126 -0
- package/system/dist/kernel/moleculer/capabilities-access.d.ts +21 -0
- package/system/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +53 -0
- package/system/dist/kernel/moleculer/child-cap-descriptors.d.ts +34 -0
- package/system/dist/kernel/moleculer/child-cap-dispatch.d.ts +59 -0
- package/system/dist/kernel/moleculer/children-batch-loader.d.ts +98 -0
- package/system/dist/kernel/moleculer/core-cap-service.d.ts +65 -0
- package/system/dist/kernel/moleculer/crash-supervisor.d.ts +50 -0
- package/system/dist/kernel/moleculer/device-cap-proxy.d.ts +70 -0
- package/system/dist/kernel/moleculer/device-event-ring.d.ts +155 -0
- package/system/dist/kernel/moleculer/event-bus-core.d.ts +198 -0
- package/system/dist/kernel/moleculer/event-bus.d.ts +106 -0
- package/system/dist/kernel/moleculer/hub-log-forwarder.d.ts +36 -0
- package/system/dist/kernel/moleculer/hub-service.d.ts +39 -0
- package/system/dist/kernel/moleculer/init-watchdog.d.ts +60 -0
- package/system/dist/kernel/moleculer/mesh-access-middleware.d.ts +42 -0
- package/system/dist/kernel/moleculer/mesh-identity.d.ts +57 -0
- package/system/dist/kernel/moleculer/mesh-mtls/constants.d.ts +17 -0
- package/system/dist/kernel/moleculer/mesh-mtls/index.d.ts +12 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca-keeper.d.ts +60 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +49 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +105 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-crl.d.ts +16 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-membership.d.ts +64 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +47 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +135 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-tls-enabler.d.ts +9 -0
- package/system/dist/kernel/moleculer/mesh-mtls/mesh-tls-gate.d.ts +40 -0
- package/system/dist/kernel/moleculer/mesh-mtls/pairing/agent-pairing.d.ts +214 -0
- package/system/dist/kernel/moleculer/mesh-mtls/pairing/hub-pairing.d.ts +115 -0
- package/system/dist/kernel/moleculer/mesh-mtls/pairing/index.d.ts +3 -0
- package/system/dist/kernel/moleculer/mesh-mtls/pairing/pairing-protocol.d.ts +107 -0
- package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +242 -0
- package/system/dist/kernel/moleculer/mesh-queue-report.d.ts +51 -0
- package/system/dist/kernel/moleculer/node-registry.d.ts +146 -0
- package/system/dist/kernel/moleculer/process-context.d.ts +4 -0
- package/system/dist/kernel/moleculer/process-service.d.ts +92 -0
- package/system/dist/kernel/moleculer/provider-registry.d.ts +28 -0
- package/system/dist/kernel/moleculer/readiness-context.d.ts +67 -0
- package/system/dist/kernel/moleculer/readiness-service.d.ts +37 -0
- package/system/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
- package/system/dist/kernel/moleculer/register-framework-resolver.d.ts +8 -0
- package/system/dist/kernel/moleculer/register-node-client.d.ts +49 -0
- package/system/dist/kernel/moleculer/remote-logger.d.ts +43 -0
- package/system/dist/kernel/moleculer/resilient-cap-call.d.ts +28 -0
- package/system/dist/kernel/moleculer/runner-addon-settings.d.ts +29 -0
- package/system/dist/kernel/moleculer/runner-device-settings.d.ts +39 -0
- package/system/dist/kernel/moleculer/runner-heap-flags.d.ts +228 -0
- package/system/dist/kernel/moleculer/runner-native-allocator.d.ts +107 -0
- package/system/dist/kernel/moleculer/runner-process-group.d.ts +96 -0
- package/system/dist/kernel/moleculer/runner-refusal.d.ts +27 -0
- package/system/dist/kernel/moleculer/runtime-state-load.d.ts +29 -0
- package/system/dist/kernel/moleculer/settings-read-guard.d.ts +49 -0
- package/system/dist/kernel/moleculer/stream-probe-service.d.ts +28 -0
- package/system/dist/kernel/moleculer/trpc-links.d.ts +244 -0
- package/system/dist/kernel/moleculer/typed-array-serde.d.ts +14 -0
- package/system/dist/kernel/moleculer/worker-device-restore.d.ts +10 -0
- package/system/dist/kernel/outbound-queue-watch.d.ts +94 -0
- package/system/dist/kernel/prefix-walk.d.ts +39 -0
- package/system/dist/kernel/process-cpu-census.d.ts +74 -0
- package/system/dist/kernel/provider-kind-drift.d.ts +21 -0
- package/system/dist/kernel/restart-coordinator.d.ts +90 -0
- package/system/dist/kernel/sections-store.d.ts +20 -0
- package/system/dist/kernel/settings-door-view.d.ts +41 -0
- package/system/dist/kernel/settings-read-error.d.ts +35 -0
- package/system/dist/kernel/settings-view-types.d.ts +80 -0
- package/system/dist/kernel/socket-plane-report.d.ts +268 -0
- package/system/dist/kernel/status-overlay.d.ts +38 -0
- package/system/dist/kernel/storage-location-registry.d.ts +55 -0
- package/system/dist/kernel/store-settings-view.d.ts +14 -0
- package/system/dist/kernel/system-settings-mirror.d.ts +46 -0
- package/system/dist/kernel/system-settings-policy.d.ts +28 -0
- package/system/dist/kernel/transport/cap-action-census.d.ts +218 -0
- package/system/dist/kernel/transport/cap-action-name.d.ts +100 -0
- package/system/dist/kernel/transport/cap-child-index.d.ts +49 -0
- package/system/dist/kernel/transport/cap-route-resolver.d.ts +231 -0
- package/system/dist/kernel/transport/cap-route.d.ts +168 -0
- package/system/dist/kernel/transport/cap-routing-hints.d.ts +42 -0
- package/system/dist/kernel/transport/child-cap-protocol.d.ts +307 -0
- package/system/dist/kernel/transport/claimed-get-status.d.ts +39 -0
- package/system/dist/kernel/transport/create-local-transport.d.ts +7 -0
- package/system/dist/kernel/transport/device-call-redirect.d.ts +39 -0
- package/system/dist/kernel/transport/frame-codec.d.ts +122 -0
- package/system/dist/kernel/transport/hub-cap-forward.d.ts +96 -0
- package/system/dist/kernel/transport/index.d.ts +38 -0
- package/system/dist/kernel/transport/local-child-client.d.ts +199 -0
- package/system/dist/kernel/transport/local-child-registry.d.ts +654 -0
- package/system/dist/kernel/transport/local-endpoint-path.d.ts +6 -0
- package/system/dist/kernel/transport/local-transport.d.ts +122 -0
- package/system/dist/kernel/transport/parent-unowned-call.d.ts +283 -0
- package/system/dist/kernel/transport/peer-answered-error.d.ts +21 -0
- package/system/dist/kernel/transport/socket-channel.d.ts +116 -0
- package/system/dist/kernel/transport/socket-traffic.d.ts +118 -0
- package/system/dist/kernel/transport/uds-event-bridge.d.ts +85 -0
- package/system/dist/kernel/transport/uds-event-bus.d.ts +93 -0
- package/system/dist/kernel/transport/uds-local-transport.d.ts +18 -0
- package/system/dist/kernel/transport/uds-log-ingest.d.ts +43 -0
- package/system/dist/kernel/transport/uds-logger.d.ts +44 -0
- package/system/dist/kernel/utils/ring-buffer.d.ts +15 -0
- package/system/dist/kernel/workspace-detect.d.ts +9 -0
- package/system/dist/lib-5THG9eKz.mjs +15545 -0
- package/system/dist/lib-C3U1yluo.js +7110 -0
- package/system/dist/lib-CZ3g2WTS.js +15549 -0
- package/system/dist/lib-DFZblCIu.mjs +7106 -0
- package/system/dist/lifecycle/lifecycle-state-machine.d.ts +28 -0
- package/system/dist/log-file-read-protocol-B7M3X3bT.mjs +785 -0
- package/system/dist/log-file-read-protocol-D0WcLbIV.js +817 -0
- package/system/dist/log-file-read-worker.js +64 -0
- package/system/dist/log-file-read-worker.mjs +64 -0
- package/system/dist/log-read-filter-Bi066jwU.js +134 -0
- package/system/dist/log-read-filter-D7Ev3zm-.mjs +93 -0
- package/system/dist/logging/formatter.d.ts +57 -0
- package/system/dist/logging/log-manager.d.ts +145 -0
- package/system/dist/logging/log-read-filter.d.ts +43 -0
- package/system/dist/logging/log-redactor.d.ts +30 -0
- package/system/dist/logging/log-ring-buffer.d.ts +62 -0
- package/system/dist/logging/logging-gate.d.ts +76 -0
- package/system/dist/logging/logging-gate.singleton.d.ts +16 -0
- package/system/dist/logging/partitioned-log-buffer.d.ts +169 -0
- package/system/dist/logging/scoped-logger.d.ts +17 -0
- package/system/dist/migrations/hub/index.d.ts +11 -0
- package/system/dist/ms-CgH2OFlD.mjs +120 -0
- package/system/dist/ms-LB3giGoU.js +124 -0
- package/system/dist/network/network-quality.d.ts +11 -0
- package/system/dist/notification/notification-service.d.ts +43 -0
- package/system/dist/notification/toast-service.d.ts +22 -0
- package/system/dist/pipeline/engine-manager-resolver.d.ts +15 -0
- package/system/dist/pipeline/pipeline-runner.d.ts +8 -0
- package/system/dist/pipeline/pipeline-validator.d.ts +13 -0
- package/system/dist/platform-key-source-BWlq0jjn.mjs +23 -0
- package/system/dist/platform-key-source-Di7HrlGR.js +40 -0
- package/system/dist/prefix-range-D_KueXbQ.js +27 -0
- package/system/dist/prefix-range-Dl0znowN.mjs +22 -0
- package/system/dist/prefix-walk-DAOBSyH1.mjs +88 -0
- package/system/dist/prefix-walk-Dv6MLZlM.js +99 -0
- package/system/dist/process/proc-stat.d.ts +75 -0
- package/system/dist/process/resource-monitor.d.ts +28 -0
- package/system/dist/python/python-env-manager.d.ts +12 -0
- package/system/dist/read-all-rows-CVoO1ONM.js +29 -0
- package/system/dist/read-all-rows-TaPqdWNF.mjs +25 -0
- package/system/dist/records/read-all-rows.d.ts +6 -0
- package/system/dist/repl/interfaces.d.ts +31 -0
- package/system/dist/repl/repl-engine.d.ts +8 -0
- package/system/dist/resource-monitor-Di9daRwI.mjs +96 -0
- package/system/dist/resource-monitor-mio9dSCT.js +113 -0
- package/system/dist/restore-archive-Cy7jGqiD.js +4325 -0
- package/system/dist/restore-archive-DS4nvQ43.mjs +4213 -0
- package/system/dist/retention-Dqm_EiVq.mjs +893 -0
- package/system/dist/retention-Ufa2fci-.js +1024 -0
- package/system/dist/retired-settings-keys-C8nOOr5H.js +381 -0
- package/system/dist/retired-settings-keys-u6xQA6r7.mjs +364 -0
- package/system/dist/safe-buffer-B1OjL1I9.mjs +42 -0
- package/system/dist/safe-buffer-D3aoa-7X.js +46 -0
- package/system/dist/settle-sources-Bhsy57y-.js +38 -0
- package/system/dist/settle-sources-CDtNC8ub.mjs +33 -0
- package/system/dist/snapshot-courtesy-CyFs1M3I.mjs +167 -0
- package/system/dist/snapshot-courtesy-D_C5-nC0.js +192 -0
- package/system/dist/sqlite-snapshot-protocol-2QaTouWV.mjs +34 -0
- package/system/dist/sqlite-snapshot-protocol-B9OndqZv.js +51 -0
- package/system/dist/sqlite-snapshot-worker.js +185 -0
- package/system/dist/sqlite-snapshot-worker.mjs +179 -0
- package/system/dist/src-CnAqG6EF.js +714 -0
- package/system/dist/src-hG4grMU4.mjs +709 -0
- package/system/dist/storage/fs-storage-backend.d.ts +40 -0
- package/system/dist/storage/storage-location-manager.d.ts +23 -0
- package/system/dist/storage/storage-manager.d.ts +83 -0
- package/system/dist/tls/agent-https-names.d.ts +25 -0
- package/system/dist/tls/agent-https.d.ts +111 -0
- package/system/dist/tls/boot-tls.d.ts +35 -0
- package/system/dist/tls/cert-backdate.d.ts +10 -0
- package/system/dist/tls/cert-evaluation.d.ts +41 -0
- package/system/dist/tls/cert-identity.d.ts +60 -0
- package/system/dist/tls/cert-issue.d.ts +57 -0
- package/system/dist/tls/cert-manager.d.ts +124 -0
- package/system/dist/tls/cert-name-constraints.d.ts +53 -0
- package/system/dist/tls/cert-utc-time.d.ts +1 -0
- package/system/dist/tls/https-listener.d.ts +30 -0
- package/system/dist/tls/index.d.ts +12 -0
- package/system/dist/tls/tls-actions.d.ts +49 -0
- package/system/dist/tls/tls-status.d.ts +57 -0
- package/system/dist/tls/uploaded-cert.d.ts +46 -0
- package/system/dist/wal-checkpoint-policy-BahrTtyD.mjs +186 -0
- package/system/dist/wal-checkpoint-policy-d2z2qPqx.js +233 -0
- package/system/dist/wal-checkpoint-worker.js +144 -0
- package/system/dist/wal-checkpoint-worker.mjs +143 -0
- package/system/dist/wal-maintenance-BmugbgS7.js +0 -0
- package/system/dist/wal-maintenance-Bnb2QzYG.mjs +0 -0
- package/system/dist/x509.es-BRiJgOvu.mjs +11939 -0
- package/system/dist/x509.es-WtnRNyYS.js +12076 -0
- package/system/package.json +516 -0
|
@@ -0,0 +1,3116 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
+
const require_dist = require("../../dist-M9yHiIY7.js");
|
|
7
|
+
let node_fs_promises = require("node:fs/promises");
|
|
8
|
+
let node_util = require("node:util");
|
|
9
|
+
let node_os = require("node:os");
|
|
10
|
+
node_os = require_chunk.__toESM(node_os);
|
|
11
|
+
let node_fs = require("node:fs");
|
|
12
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
13
|
+
let node_child_process = require("node:child_process");
|
|
14
|
+
//#region src/builtins/native-metrics/cgroup-memory.ts
|
|
15
|
+
/** `readFileSync`, with every failure flattened to `null`. */
|
|
16
|
+
var nodeCgroupFileReader = { read(path) {
|
|
17
|
+
try {
|
|
18
|
+
return (0, node_fs.readFileSync)(path, "utf8");
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
} };
|
|
23
|
+
/** Where the v2 unified hierarchy is mounted, and where v1 hangs its controllers. */
|
|
24
|
+
var CGROUP_MOUNT_ROOT = "/sys/fs/cgroup";
|
|
25
|
+
/**
|
|
26
|
+
* The i915 GEM accounting file.
|
|
27
|
+
*
|
|
28
|
+
* **debugfs, and it is not mounted in our containers.** Verified on the live
|
|
29
|
+
* hub on 2026-08-29: readable on the Unraid host (`6014 shrinkable [0 free]
|
|
30
|
+
* objects, 1194934272 bytes`), `ENOENT` inside the `CamStack` container where
|
|
31
|
+
* `native-metrics` actually runs. It is probed ONCE per process and latched —
|
|
32
|
+
* a bind mount cannot appear under a running container — so an absent file
|
|
33
|
+
* costs one failed `open` for the life of the runner and one log line, never a
|
|
34
|
+
* failure per tick.
|
|
35
|
+
*
|
|
36
|
+
* Making it populate is a one-line change on the container, not here:
|
|
37
|
+
* mounting `/sys/kernel/debug` read-only into `CamStack` fills this field on
|
|
38
|
+
* the next sample with no code change.
|
|
39
|
+
*/
|
|
40
|
+
var I915_GEM_OBJECTS_PATH = "/sys/kernel/debug/dri/0/i915_gem_objects";
|
|
41
|
+
/**
|
|
42
|
+
* v1's "no limit" sentinel — `PAGE_COUNTER_MAX << PAGE_SHIFT`, which is what a
|
|
43
|
+
* 64-bit kernel writes into `memory.limit_in_bytes` when nothing is set. It is
|
|
44
|
+
* a limit in the same sense that `Infinity` is a number, so it reads as `null`.
|
|
45
|
+
*/
|
|
46
|
+
var V1_UNLIMITED_SENTINEL = 0x7ffffffffffff000;
|
|
47
|
+
/**
|
|
48
|
+
* Parse `/proc/self/cgroup`.
|
|
49
|
+
*
|
|
50
|
+
* Two formats, and the file may contain both on a hybrid host:
|
|
51
|
+
*
|
|
52
|
+
* ```
|
|
53
|
+
* 0::/ ← v2 unified
|
|
54
|
+
* 5:memory:/docker/9f3c… ← v1, memory controller
|
|
55
|
+
* 4:cpu,cpuacct:/docker/9f3c… ← v1, other controllers
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* v2 wins when present: on a hybrid host the unified hierarchy is the one
|
|
59
|
+
* carrying `memory.current`, and every camstack deployment is v2 (verified on
|
|
60
|
+
* the live hub, which reports the single line `0::/`).
|
|
61
|
+
*
|
|
62
|
+
* Returns `null` when the file names no memory hierarchy at all — which is
|
|
63
|
+
* also what a non-Linux host produces, because there is no file to read.
|
|
64
|
+
*/
|
|
65
|
+
function parseCgroupSelf(text) {
|
|
66
|
+
let v1 = null;
|
|
67
|
+
for (const rawLine of text.split("\n")) {
|
|
68
|
+
const line = rawLine.trim();
|
|
69
|
+
if (line.length === 0) continue;
|
|
70
|
+
const first = line.indexOf(":");
|
|
71
|
+
if (first < 0) continue;
|
|
72
|
+
const second = line.indexOf(":", first + 1);
|
|
73
|
+
if (second < 0) continue;
|
|
74
|
+
const controllers = line.slice(first + 1, second);
|
|
75
|
+
const path = line.slice(second + 1);
|
|
76
|
+
if (path.length === 0) continue;
|
|
77
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
78
|
+
if (controllers.length === 0) return {
|
|
79
|
+
version: "v2",
|
|
80
|
+
path: normalized
|
|
81
|
+
};
|
|
82
|
+
if (v1 === null && controllers.split(",").includes("memory")) v1 = {
|
|
83
|
+
version: "v1",
|
|
84
|
+
path: normalized
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return v1;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Parse a `memory.stat` file — v1 or v2, both are `key value` per line.
|
|
91
|
+
*
|
|
92
|
+
* Unknown keys are KEPT rather than refused: a v2 `memory.stat` carries ~50
|
|
93
|
+
* fields and we read five of them, and a kernel that adds a sixth must not
|
|
94
|
+
* turn into a parse failure. A malformed line is skipped, not thrown on.
|
|
95
|
+
*/
|
|
96
|
+
function parseCgroupStat(text) {
|
|
97
|
+
const out = /* @__PURE__ */ new Map();
|
|
98
|
+
for (const rawLine of text.split("\n")) {
|
|
99
|
+
const line = rawLine.trim();
|
|
100
|
+
if (line.length === 0) continue;
|
|
101
|
+
const space = line.indexOf(" ");
|
|
102
|
+
if (space <= 0) continue;
|
|
103
|
+
const key = line.slice(0, space);
|
|
104
|
+
const value = Number(line.slice(space + 1).trim());
|
|
105
|
+
if (!Number.isFinite(value)) continue;
|
|
106
|
+
out.set(key, value);
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse a single-scalar cgroup file (`memory.current`, `memory.max`, …).
|
|
112
|
+
*
|
|
113
|
+
* `max` — v2's word for "no limit" — and v1's `V1_UNLIMITED_SENTINEL` both
|
|
114
|
+
* become `null`, because a ceiling nothing can reach is not a ceiling and
|
|
115
|
+
* charting it as 8 exabytes would flatten every real series to zero.
|
|
116
|
+
*/
|
|
117
|
+
function parseCgroupScalar(text) {
|
|
118
|
+
const trimmed = text.trim();
|
|
119
|
+
if (trimmed.length === 0) return null;
|
|
120
|
+
if (trimmed === "max") return null;
|
|
121
|
+
const value = Number(trimmed);
|
|
122
|
+
if (!Number.isFinite(value) || value < 0) return null;
|
|
123
|
+
if (value >= V1_UNLIMITED_SENTINEL) return null;
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parse the first line of `i915_gem_objects`.
|
|
128
|
+
*
|
|
129
|
+
* ```
|
|
130
|
+
* 6014 shrinkable [0 free] objects, 1194934272 bytes
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* Only the byte total is taken. The format has changed across kernel releases
|
|
134
|
+
* more than once, so a line that does not match reads `null` — an unrecognised
|
|
135
|
+
* format is UNKNOWN, never zero.
|
|
136
|
+
*/
|
|
137
|
+
function parseI915GemObjects(text) {
|
|
138
|
+
const match = text.match(/^\s*\d+\s+shrinkable\b[^,\n]*,\s*(\d+)\s+bytes/m);
|
|
139
|
+
if (match === null) return null;
|
|
140
|
+
const bytes = Number(match[1]);
|
|
141
|
+
return Number.isFinite(bytes) ? bytes : null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Find the cgroup from INSIDE this process — never a hard-coded path.
|
|
145
|
+
*
|
|
146
|
+
* The path the hub happens to have (`/sys/fs/cgroup/docker/<id>/memory.stat`
|
|
147
|
+
* as seen from the Unraid host) is an artefact of where you are standing. From
|
|
148
|
+
* inside the container the same cgroup is at the mount ROOT, because Docker
|
|
149
|
+
* gives the container its own cgroup namespace and `/proc/self/cgroup` reports
|
|
150
|
+
* `0::/`. Hard-coding either one breaks the other.
|
|
151
|
+
*
|
|
152
|
+
* So the resolution is: ask `/proc/self/cgroup` which hierarchy and which
|
|
153
|
+
* path, then take the FIRST candidate directory that actually publishes the
|
|
154
|
+
* usage file.
|
|
155
|
+
*
|
|
156
|
+
* - **v2** — `<mount><path>` then `<mount>`. The second candidate is the
|
|
157
|
+
* namespaced case and the one that answers on our hub; the first is the
|
|
158
|
+
* un-namespaced case (a host process, or `--cgroupns=host`).
|
|
159
|
+
* - **v1** — `<mount>/memory<path>` then `<mount>/memory`, same reasoning.
|
|
160
|
+
* - **neither** — `null`. macOS has no `/proc/self/cgroup` at all, so a
|
|
161
|
+
* developer Mac lands here and reports nothing, which is the truth.
|
|
162
|
+
*/
|
|
163
|
+
function resolveCgroupMemoryLayout(fs) {
|
|
164
|
+
const selfText = fs.read("/proc/self/cgroup");
|
|
165
|
+
if (selfText === null) return null;
|
|
166
|
+
const entry = parseCgroupSelf(selfText);
|
|
167
|
+
if (entry === null) return null;
|
|
168
|
+
const suffix = entry.path === "/" ? "" : entry.path;
|
|
169
|
+
const candidates = entry.version === "v2" ? [`${CGROUP_MOUNT_ROOT}${suffix}`, CGROUP_MOUNT_ROOT] : [`${CGROUP_MOUNT_ROOT}/memory${suffix}`, `${CGROUP_MOUNT_ROOT}/memory`];
|
|
170
|
+
const usageFile = entry.version === "v2" ? "memory.current" : "memory.usage_in_bytes";
|
|
171
|
+
const limitFile = entry.version === "v2" ? "memory.max" : "memory.limit_in_bytes";
|
|
172
|
+
for (const directory of candidates) {
|
|
173
|
+
if (fs.read(`${directory}/${usageFile}`) === null) continue;
|
|
174
|
+
return {
|
|
175
|
+
source: entry.version === "v2" ? "cgroup-v2" : "cgroup-v1",
|
|
176
|
+
directory,
|
|
177
|
+
currentPath: `${directory}/${usageFile}`,
|
|
178
|
+
limitPath: `${directory}/${limitFile}`,
|
|
179
|
+
statPath: `${directory}/memory.stat`
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
/** A stat lookup that answers `null` for a key this hierarchy does not publish. */
|
|
185
|
+
function statValue(stat, key) {
|
|
186
|
+
const value = stat.get(key);
|
|
187
|
+
return value === void 0 ? null : value;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* v2 publishes `slab` directly; older v2 kernels publish only the two halves.
|
|
191
|
+
* Summing them is the same number, so the fallback is exact rather than an
|
|
192
|
+
* approximation — and when neither is present the answer is `null`.
|
|
193
|
+
*/
|
|
194
|
+
function resolveSlab(stat) {
|
|
195
|
+
const direct = statValue(stat, "slab");
|
|
196
|
+
if (direct !== null) return direct;
|
|
197
|
+
const reclaimable = stat.get("slab_reclaimable");
|
|
198
|
+
const unreclaimable = stat.get("slab_unreclaimable");
|
|
199
|
+
if (reclaimable === void 0 || unreclaimable === void 0) return null;
|
|
200
|
+
return reclaimable + unreclaimable;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Turn one layout's three files into a snapshot.
|
|
204
|
+
*
|
|
205
|
+
* Pure over the text, so the whole mapping — including a v2 `memory.stat` full
|
|
206
|
+
* of fields we do not read — is testable against a real fixture.
|
|
207
|
+
*
|
|
208
|
+
* v1's `memory.stat` names the same quantities differently and publishes fewer
|
|
209
|
+
* of them: `rss` is the anonymous charge, `cache` is the page cache, and there
|
|
210
|
+
* is no slab accounting at all. Mapping them onto the same field names is what
|
|
211
|
+
* makes a v1 node and a v2 node comparable; reporting `slabBytes: null` on v1
|
|
212
|
+
* is what stops that comparison from lying.
|
|
213
|
+
*/
|
|
214
|
+
function buildContainerMemorySnapshot(input) {
|
|
215
|
+
const currentBytes = parseCgroupScalar(input.currentText);
|
|
216
|
+
if (currentBytes === null) return null;
|
|
217
|
+
const stat = input.statText === null ? /* @__PURE__ */ new Map() : parseCgroupStat(input.statText);
|
|
218
|
+
const isV2 = input.source === "cgroup-v2";
|
|
219
|
+
return {
|
|
220
|
+
source: input.source,
|
|
221
|
+
currentBytes,
|
|
222
|
+
limitBytes: input.limitText === null ? null : parseCgroupScalar(input.limitText),
|
|
223
|
+
anonBytes: statValue(stat, isV2 ? "anon" : "rss"),
|
|
224
|
+
fileBytes: statValue(stat, isV2 ? "file" : "cache"),
|
|
225
|
+
shmemBytes: statValue(stat, "shmem"),
|
|
226
|
+
slabBytes: isV2 ? resolveSlab(stat) : null,
|
|
227
|
+
gpuShmemBytes: input.gpuShmemBytes
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The sampler. Resolves once, latches, and logs TRANSITIONS only.
|
|
232
|
+
*
|
|
233
|
+
* Three states are worth a line and none of them is worth one per tick:
|
|
234
|
+
*
|
|
235
|
+
* 1. **Resolution** — once, at the first sample. Either the layout that
|
|
236
|
+
* answered, or "no cgroup on this node", which is a fact about the node and
|
|
237
|
+
* not an error.
|
|
238
|
+
* 2. **GPU probe** — once, at the first sample. Absent debugfs is the normal
|
|
239
|
+
* case inside a container and is stated as such, then never retried: a bind
|
|
240
|
+
* mount cannot appear under a running container.
|
|
241
|
+
* 3. **Read failing / recovering** — a cgroup that resolved and then stopped
|
|
242
|
+
* answering is a real change and says so, once in each direction. A tick
|
|
243
|
+
* that fails while already failing is silent, because the first line
|
|
244
|
+
* already said it.
|
|
245
|
+
*
|
|
246
|
+
* The silence is bounded by design: at the 10 s snapshot cadence a per-tick
|
|
247
|
+
* warning would be 8 640 lines a day on a node that simply is not Linux.
|
|
248
|
+
*/
|
|
249
|
+
var ContainerMemoryProbe = class {
|
|
250
|
+
logger;
|
|
251
|
+
fs;
|
|
252
|
+
wantGpu;
|
|
253
|
+
resolved = false;
|
|
254
|
+
layout = null;
|
|
255
|
+
gpuProbed = false;
|
|
256
|
+
gpuReadable = false;
|
|
257
|
+
/** `null` until the first sample — so the FIRST outcome is a transition too. */
|
|
258
|
+
lastReadOk = null;
|
|
259
|
+
constructor(deps) {
|
|
260
|
+
this.logger = deps.logger;
|
|
261
|
+
this.fs = deps.fs ?? nodeCgroupFileReader;
|
|
262
|
+
this.wantGpu = deps.readGpu ?? true;
|
|
263
|
+
}
|
|
264
|
+
/** Did this node resolve a cgroup at all? Absent is a reportable fact. */
|
|
265
|
+
get available() {
|
|
266
|
+
return this.layout !== null;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* One reading, or `null` when this node has no cgroup or the cgroup stopped
|
|
270
|
+
* answering. `null` is ABSENT — the caller contributes no point, and no
|
|
271
|
+
* point is what a chart must show, never a zero.
|
|
272
|
+
*/
|
|
273
|
+
sample() {
|
|
274
|
+
const layout = this.resolveOnce();
|
|
275
|
+
if (layout === null) return null;
|
|
276
|
+
const currentText = this.fs.read(layout.currentPath);
|
|
277
|
+
if (currentText === null) {
|
|
278
|
+
this.noteRead(false, `unreadable: ${layout.currentPath}`);
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
const snapshot = buildContainerMemorySnapshot({
|
|
282
|
+
source: layout.source,
|
|
283
|
+
currentText,
|
|
284
|
+
limitText: this.fs.read(layout.limitPath),
|
|
285
|
+
statText: this.fs.read(layout.statPath),
|
|
286
|
+
gpuShmemBytes: this.readGpuShmem()
|
|
287
|
+
});
|
|
288
|
+
if (snapshot === null) {
|
|
289
|
+
this.noteRead(false, `unparseable: ${layout.currentPath}`);
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
this.noteRead(true, null);
|
|
293
|
+
return snapshot;
|
|
294
|
+
}
|
|
295
|
+
/** Resolve on first use and never again — a cgroup does not move under a pid. */
|
|
296
|
+
resolveOnce() {
|
|
297
|
+
if (this.resolved) return this.layout;
|
|
298
|
+
this.resolved = true;
|
|
299
|
+
try {
|
|
300
|
+
this.layout = resolveCgroupMemoryLayout(this.fs);
|
|
301
|
+
} catch (err) {
|
|
302
|
+
this.layout = null;
|
|
303
|
+
this.logger.warn("cgroup memory resolution failed — container memory will be ABSENT", { meta: { error: require_dist.errMsg(err) } });
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
if (this.layout === null) {
|
|
307
|
+
this.logger.info("no cgroup on this node — container memory is ABSENT, not zero, for every sample", { meta: {
|
|
308
|
+
platform: process.platform,
|
|
309
|
+
probed: "/proc/self/cgroup"
|
|
310
|
+
} });
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
this.logger.info("container memory resolved from the cgroup", { meta: {
|
|
314
|
+
source: this.layout.source,
|
|
315
|
+
directory: this.layout.directory
|
|
316
|
+
} });
|
|
317
|
+
return this.layout;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* The GPU number, probed once.
|
|
321
|
+
*
|
|
322
|
+
* It is host-wide and lives in debugfs, so it is absent far more often than
|
|
323
|
+
* it is present — inside every camstack container today. One `open` decides
|
|
324
|
+
* it for the life of the process; after that an unreadable file costs
|
|
325
|
+
* nothing at all, not even a syscall.
|
|
326
|
+
*/
|
|
327
|
+
readGpuShmem() {
|
|
328
|
+
if (!this.wantGpu) return null;
|
|
329
|
+
if (!this.gpuProbed) {
|
|
330
|
+
this.gpuProbed = true;
|
|
331
|
+
const text = this.fs.read(I915_GEM_OBJECTS_PATH);
|
|
332
|
+
this.gpuReadable = text !== null && parseI915GemObjects(text) !== null;
|
|
333
|
+
this.logger.info(this.gpuReadable ? "i915 GEM accounting is readable — GPU-backed shmem will be reported" : "i915 GEM accounting is NOT readable — gpuShmemBytes stays UNKNOWN (this is normal: debugfs is not mounted in the container, and a node with no Intel GPU has no such file)", { meta: { path: I915_GEM_OBJECTS_PATH } });
|
|
334
|
+
if (!this.gpuReadable) return null;
|
|
335
|
+
return text === null ? null : parseI915GemObjects(text);
|
|
336
|
+
}
|
|
337
|
+
if (!this.gpuReadable) return null;
|
|
338
|
+
const text = this.fs.read(I915_GEM_OBJECTS_PATH);
|
|
339
|
+
return text === null ? null : parseI915GemObjects(text);
|
|
340
|
+
}
|
|
341
|
+
/** Log a read outcome only when it CHANGES. Never once per tick. */
|
|
342
|
+
noteRead(ok, reason) {
|
|
343
|
+
if (this.lastReadOk === ok) return;
|
|
344
|
+
const first = this.lastReadOk === null;
|
|
345
|
+
this.lastReadOk = ok;
|
|
346
|
+
if (!ok) {
|
|
347
|
+
this.logger.warn("cgroup memory stopped answering — container memory is ABSENT until it returns", { meta: { reason: reason ?? "unknown" } });
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (!first) this.logger.info("cgroup memory is answering again");
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/builtins/native-metrics/cgroup-pids.ts
|
|
355
|
+
/**
|
|
356
|
+
* `pids.max` is either a number or the word `max`.
|
|
357
|
+
*
|
|
358
|
+
* `max` means NO ceiling, and that is `null` — not `Infinity`, not a huge
|
|
359
|
+
* number. A ceiling nothing can reach is not a ceiling, and reporting one
|
|
360
|
+
* would make every utilisation fraction on an unlimited node read as 0 %.
|
|
361
|
+
*/
|
|
362
|
+
function parsePidsMax(text) {
|
|
363
|
+
const trimmed = text.trim();
|
|
364
|
+
if (trimmed.length === 0 || trimmed === "max") return null;
|
|
365
|
+
const value = Number(trimmed);
|
|
366
|
+
if (!Number.isFinite(value) || value < 0) return null;
|
|
367
|
+
return value;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* `pids.events` is `key value` per line; we read exactly one key:
|
|
371
|
+
*
|
|
372
|
+
* ```
|
|
373
|
+
* max 22
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* `max` is the number of times a fork was refused because the limit was hit.
|
|
377
|
+
* A kernel that publishes only `pids.events.local`, or a file we cannot make
|
|
378
|
+
* sense of, answers `null` — unknown, never zero, because zero here means "no
|
|
379
|
+
* refusals have ever happened" and that is a claim.
|
|
380
|
+
*/
|
|
381
|
+
function parsePidsEvents(text) {
|
|
382
|
+
for (const rawLine of text.split("\n")) {
|
|
383
|
+
const line = rawLine.trim();
|
|
384
|
+
if (line.length === 0) continue;
|
|
385
|
+
const space = line.indexOf(" ");
|
|
386
|
+
if (space <= 0) continue;
|
|
387
|
+
if (line.slice(0, space) !== "max") continue;
|
|
388
|
+
const value = Number(line.slice(space + 1).trim());
|
|
389
|
+
if (!Number.isFinite(value) || value < 0) return null;
|
|
390
|
+
return value;
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
/** Turn one layout's files into a snapshot. Pure over the text. */
|
|
395
|
+
function buildContainerPidsSnapshot(input) {
|
|
396
|
+
const current = Number(input.currentText.trim());
|
|
397
|
+
if (!Number.isFinite(current) || current < 0) return null;
|
|
398
|
+
const max = input.maxText === null ? null : parsePidsMax(input.maxText);
|
|
399
|
+
return {
|
|
400
|
+
source: input.source,
|
|
401
|
+
current,
|
|
402
|
+
max,
|
|
403
|
+
usedFraction: max === null || max === 0 ? null : current / max,
|
|
404
|
+
refusals: input.eventsText === null ? null : parsePidsEvents(input.eventsText)
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Find the pids cgroup from INSIDE this process, never a hard-coded path —
|
|
409
|
+
* same reasoning as the memory layout: from inside the container the cgroup is
|
|
410
|
+
* at the mount ROOT (`0::/`), from the host it is `<mount>/docker/<id>`, and
|
|
411
|
+
* hard-coding either one breaks the other.
|
|
412
|
+
*/
|
|
413
|
+
function resolveCgroupPidsLayout(fs) {
|
|
414
|
+
const selfText = fs.read("/proc/self/cgroup");
|
|
415
|
+
if (selfText === null) return null;
|
|
416
|
+
const entry = parseCgroupSelf(selfText);
|
|
417
|
+
if (entry === null) return null;
|
|
418
|
+
const suffix = entry.path === "/" ? "" : entry.path;
|
|
419
|
+
const candidates = entry.version === "v2" ? [`${CGROUP_MOUNT_ROOT}${suffix}`, CGROUP_MOUNT_ROOT] : [`${CGROUP_MOUNT_ROOT}/pids${suffix}`, `${CGROUP_MOUNT_ROOT}/pids`];
|
|
420
|
+
for (const directory of candidates) {
|
|
421
|
+
if (fs.read(`${directory}/pids.current`) === null) continue;
|
|
422
|
+
return {
|
|
423
|
+
source: entry.version === "v2" ? "cgroup-v2" : "cgroup-v1",
|
|
424
|
+
directory,
|
|
425
|
+
currentPath: `${directory}/pids.current`,
|
|
426
|
+
maxPath: `${directory}/pids.max`,
|
|
427
|
+
eventsPath: `${directory}/pids.events`
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
var DEFAULT_HEARTBEAT_MS = 6e4;
|
|
433
|
+
var DEFAULT_PRESSURE_FRACTION = .8;
|
|
434
|
+
/**
|
|
435
|
+
* The sampler.
|
|
436
|
+
*
|
|
437
|
+
* Its logging is deliberately different from the memory probe's, because the
|
|
438
|
+
* operator asked for a DAY of regular readings before deciding whether to
|
|
439
|
+
* raise the ceiling: there is a heartbeat, on its own cadence, whatever the
|
|
440
|
+
* sampling tick is. Three lines exist and no more:
|
|
441
|
+
*
|
|
442
|
+
* 1. **Resolution**, once — the hierarchy that answered, or "no cgroup here",
|
|
443
|
+
* which is a fact about the node and not an error.
|
|
444
|
+
* 2. **Heartbeat**, every `heartbeatMs` — current, ceiling, utilisation and
|
|
445
|
+
* the lifetime refusal count. INFO while there is room, WARN while we are
|
|
446
|
+
* above `pressureFraction`, and one INFO when it comes back down, so the
|
|
447
|
+
* log carries BOTH edges of a pressure episode rather than only its start.
|
|
448
|
+
* 3. **A refusal**, immediately — the `pids.events` counter rose, so the
|
|
449
|
+
* kernel said no that many times since the last sample and some subsystem
|
|
450
|
+
* silently did without a thread. This one never waits for the heartbeat.
|
|
451
|
+
*/
|
|
452
|
+
var ContainerPidsProbe = class {
|
|
453
|
+
logger;
|
|
454
|
+
fs;
|
|
455
|
+
now;
|
|
456
|
+
heartbeatMs;
|
|
457
|
+
pressureFraction;
|
|
458
|
+
resolved = false;
|
|
459
|
+
layout = null;
|
|
460
|
+
lastHeartbeatAt = null;
|
|
461
|
+
lastRefusals = null;
|
|
462
|
+
underPressure = false;
|
|
463
|
+
constructor(deps) {
|
|
464
|
+
this.logger = deps.logger;
|
|
465
|
+
this.fs = deps.fs ?? nodeCgroupFileReader;
|
|
466
|
+
this.now = deps.now ?? Date.now;
|
|
467
|
+
this.heartbeatMs = deps.heartbeatMs ?? DEFAULT_HEARTBEAT_MS;
|
|
468
|
+
this.pressureFraction = deps.pressureFraction ?? DEFAULT_PRESSURE_FRACTION;
|
|
469
|
+
}
|
|
470
|
+
/** Did this node resolve a pids cgroup at all? Absent is a reportable fact. */
|
|
471
|
+
get available() {
|
|
472
|
+
return this.layout !== null;
|
|
473
|
+
}
|
|
474
|
+
/** One reading, or `null` where there is no cgroup or it stopped answering. */
|
|
475
|
+
sample() {
|
|
476
|
+
const layout = this.resolveOnce();
|
|
477
|
+
if (layout === null) return null;
|
|
478
|
+
const currentText = this.fs.read(layout.currentPath);
|
|
479
|
+
if (currentText === null) return null;
|
|
480
|
+
const snapshot = buildContainerPidsSnapshot({
|
|
481
|
+
source: layout.source,
|
|
482
|
+
currentText,
|
|
483
|
+
maxText: this.fs.read(layout.maxPath),
|
|
484
|
+
eventsText: this.fs.read(layout.eventsPath)
|
|
485
|
+
});
|
|
486
|
+
if (snapshot === null) return null;
|
|
487
|
+
this.report(snapshot);
|
|
488
|
+
return snapshot;
|
|
489
|
+
}
|
|
490
|
+
resolveOnce() {
|
|
491
|
+
if (this.resolved) return this.layout;
|
|
492
|
+
this.resolved = true;
|
|
493
|
+
try {
|
|
494
|
+
this.layout = resolveCgroupPidsLayout(this.fs);
|
|
495
|
+
} catch (err) {
|
|
496
|
+
this.layout = null;
|
|
497
|
+
this.logger.warn("cgroup pids resolution failed — the pid ceiling will be ABSENT", { meta: { error: require_dist.errMsg(err) } });
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
if (this.layout === null) {
|
|
501
|
+
this.logger.info("no pids cgroup on this node — the pid ceiling is ABSENT, not unlimited, for every sample", { meta: {
|
|
502
|
+
platform: process.platform,
|
|
503
|
+
probed: "/proc/self/cgroup"
|
|
504
|
+
} });
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
this.logger.info("pid ceiling resolved from the cgroup", { meta: {
|
|
508
|
+
source: this.layout.source,
|
|
509
|
+
directory: this.layout.directory
|
|
510
|
+
} });
|
|
511
|
+
return this.layout;
|
|
512
|
+
}
|
|
513
|
+
report(snapshot) {
|
|
514
|
+
this.reportRefusals(snapshot);
|
|
515
|
+
const at = this.now();
|
|
516
|
+
const pressure = snapshot.usedFraction !== null && snapshot.usedFraction >= this.pressureFraction;
|
|
517
|
+
if (this.underPressure && !pressure) {
|
|
518
|
+
this.underPressure = false;
|
|
519
|
+
this.logger.info("pid pressure recovered — back under the guard fraction", { meta: this.meta(snapshot) });
|
|
520
|
+
this.lastHeartbeatAt = at;
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (!(this.lastHeartbeatAt === null || at - this.lastHeartbeatAt >= this.heartbeatMs)) return;
|
|
524
|
+
this.lastHeartbeatAt = at;
|
|
525
|
+
this.underPressure = pressure;
|
|
526
|
+
if (pressure) {
|
|
527
|
+
this.logger.warn("pid ceiling is being approached — a refused clone() is silent work loss, and this container counts THREADS", { meta: this.meta(snapshot) });
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
this.logger.info("pid ceiling", { meta: this.meta(snapshot) });
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The counter only ever rises, so a rise is a refusal that happened in this
|
|
534
|
+
* window. Reported the moment it is seen — never held for the heartbeat,
|
|
535
|
+
* because this is the line that says work was lost.
|
|
536
|
+
*/
|
|
537
|
+
reportRefusals(snapshot) {
|
|
538
|
+
const refusals = snapshot.refusals;
|
|
539
|
+
if (refusals === null) return;
|
|
540
|
+
const previous = this.lastRefusals;
|
|
541
|
+
this.lastRefusals = refusals;
|
|
542
|
+
if (previous === null || refusals <= previous) return;
|
|
543
|
+
this.logger.warn("the kernel REFUSED a fork at the pid ceiling — something asked for a thread and did not get one", { meta: {
|
|
544
|
+
...this.meta(snapshot),
|
|
545
|
+
refusedSinceLastSample: refusals - previous
|
|
546
|
+
} });
|
|
547
|
+
}
|
|
548
|
+
meta(snapshot) {
|
|
549
|
+
return {
|
|
550
|
+
current: snapshot.current,
|
|
551
|
+
max: snapshot.max,
|
|
552
|
+
usedPct: snapshot.usedFraction === null ? null : Math.round(snapshot.usedFraction * 1e3) / 10,
|
|
553
|
+
refusalsLifetime: snapshot.refusals,
|
|
554
|
+
source: snapshot.source
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* One node's fixed-capacity circular buffer of samples.
|
|
560
|
+
*
|
|
561
|
+
* Mirrors {@link LogRingBuffer}: write at `head`, wrap, and once full every
|
|
562
|
+
* accepted sample evicts the oldest. `rows` is carried alongside so the fleet
|
|
563
|
+
* budget never has to walk the samples to know what a partition costs.
|
|
564
|
+
*/
|
|
565
|
+
var LoadPartition = class {
|
|
566
|
+
capacity;
|
|
567
|
+
slots;
|
|
568
|
+
head = 0;
|
|
569
|
+
count = 0;
|
|
570
|
+
rows = 0;
|
|
571
|
+
/** Newest retained sample's timestamp — the monotonic gate for `push`. */
|
|
572
|
+
newestAtMs = null;
|
|
573
|
+
constructor(capacity) {
|
|
574
|
+
this.capacity = capacity;
|
|
575
|
+
this.slots = Array.from({ length: capacity });
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Accept a sample.
|
|
579
|
+
*
|
|
580
|
+
* A sample at or before the newest one already held is REFUSED. The bus drops
|
|
581
|
+
* a node's own broadcast echo, but a cross-node redelivery or a replayed
|
|
582
|
+
* subscription must not be able to double a point — and idempotence here is
|
|
583
|
+
* what lets every reader above treat the series as a set.
|
|
584
|
+
*
|
|
585
|
+
* `accepted` is reported separately from `rowDelta` on purpose: a full ring
|
|
586
|
+
* that evicts a sample of the same size has a delta of zero and is not a
|
|
587
|
+
* refusal, and conflating the two would silently stop advancing the write
|
|
588
|
+
* ordinal on a steady-state cluster.
|
|
589
|
+
*/
|
|
590
|
+
push(sample) {
|
|
591
|
+
if (this.newestAtMs !== null && sample.atMs <= this.newestAtMs) return {
|
|
592
|
+
accepted: false,
|
|
593
|
+
rowDelta: 0
|
|
594
|
+
};
|
|
595
|
+
const evicted = this.count === this.capacity ? this.slots[this.head]?.processes.length ?? 0 : 0;
|
|
596
|
+
this.slots[this.head] = sample;
|
|
597
|
+
this.head = (this.head + 1) % this.capacity;
|
|
598
|
+
if (this.count < this.capacity) this.count++;
|
|
599
|
+
this.newestAtMs = sample.atMs;
|
|
600
|
+
const rowDelta = sample.processes.length - evicted;
|
|
601
|
+
this.rows += rowDelta;
|
|
602
|
+
return {
|
|
603
|
+
accepted: true,
|
|
604
|
+
rowDelta
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
/** Drop the oldest sample. Returns the rows reclaimed (0 when empty). */
|
|
608
|
+
dropOldest() {
|
|
609
|
+
if (this.count === 0) return 0;
|
|
610
|
+
const index = (this.head - this.count + this.capacity) % this.capacity;
|
|
611
|
+
const victim = this.slots[index];
|
|
612
|
+
this.slots[index] = void 0;
|
|
613
|
+
this.count--;
|
|
614
|
+
const reclaimed = victim?.processes.length ?? 0;
|
|
615
|
+
this.rows -= reclaimed;
|
|
616
|
+
if (this.count === 0) this.newestAtMs = null;
|
|
617
|
+
return reclaimed;
|
|
618
|
+
}
|
|
619
|
+
/** Oldest-first, optionally only what is strictly newer than `sinceMs`. */
|
|
620
|
+
list(sinceMs) {
|
|
621
|
+
const out = [];
|
|
622
|
+
for (let i = 0; i < this.count; i++) {
|
|
623
|
+
const index = (this.head - this.count + i + this.capacity) % this.capacity;
|
|
624
|
+
const sample = this.slots[index];
|
|
625
|
+
if (sample === void 0) continue;
|
|
626
|
+
if (sinceMs !== void 0 && sample.atMs <= sinceMs) continue;
|
|
627
|
+
out.push(sample);
|
|
628
|
+
}
|
|
629
|
+
return out;
|
|
630
|
+
}
|
|
631
|
+
size() {
|
|
632
|
+
return this.count;
|
|
633
|
+
}
|
|
634
|
+
rowCount() {
|
|
635
|
+
return this.rows;
|
|
636
|
+
}
|
|
637
|
+
oldestAtMs() {
|
|
638
|
+
if (this.count === 0) return null;
|
|
639
|
+
const index = (this.head - this.count + this.capacity) % this.capacity;
|
|
640
|
+
return this.slots[index]?.atMs ?? null;
|
|
641
|
+
}
|
|
642
|
+
lastWriteAtMs() {
|
|
643
|
+
return this.newestAtMs;
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* The partitioned ring: one {@link LoadPartition} per node id.
|
|
648
|
+
*
|
|
649
|
+
* Three bounds, doing three different jobs — the same division as the log
|
|
650
|
+
* buffer, for the same reason:
|
|
651
|
+
*
|
|
652
|
+
* - **`samplesPerNode`** is HARD and per partition. It is what the operator
|
|
653
|
+
* asked for (an hour) and it can never be exceeded.
|
|
654
|
+
* - **`maxTotalProcessRows`** is the FLEET budget, and it is denominated in the
|
|
655
|
+
* thing memory is proportional to. When it bites, the oldest sample of the
|
|
656
|
+
* HEAVIEST partition is dropped — the node creating the pressure is the node
|
|
657
|
+
* that pays, and a quiet node keeps its full hour. The node just written to is
|
|
658
|
+
* NOT protected here: if it is the heaviest, it is the culprit.
|
|
659
|
+
* - **`maxNodes`** is the backstop against an unbounded key space, and it drops
|
|
660
|
+
* whole partitions least-recently-written first, never the one being written.
|
|
661
|
+
*
|
|
662
|
+
* Plus {@link DEFAULT_NODE_IDLE_EVICTION_MS}, which is what stops a node that
|
|
663
|
+
* simply stopped emitting from living in memory forever.
|
|
664
|
+
*/
|
|
665
|
+
var NodeLoadRing = class {
|
|
666
|
+
partitions = /* @__PURE__ */ new Map();
|
|
667
|
+
/**
|
|
668
|
+
* Node id → write ordinal of its last accepted sample. A monotonic counter,
|
|
669
|
+
* not a clock: partition eviction must follow the order writes actually
|
|
670
|
+
* happened, and node clocks disagree.
|
|
671
|
+
*/
|
|
672
|
+
lastWriteSeq = /* @__PURE__ */ new Map();
|
|
673
|
+
writeSeq = 0;
|
|
674
|
+
totalRows = 0;
|
|
675
|
+
samplesPerNode;
|
|
676
|
+
maxTotalProcessRows;
|
|
677
|
+
maxNodes;
|
|
678
|
+
idleEvictionMs;
|
|
679
|
+
now;
|
|
680
|
+
constructor(options = {}) {
|
|
681
|
+
this.samplesPerNode = options.samplesPerNode ?? 180;
|
|
682
|
+
this.maxTotalProcessRows = options.maxTotalProcessRows ?? 32e3;
|
|
683
|
+
this.maxNodes = options.maxNodes ?? 16;
|
|
684
|
+
this.idleEvictionMs = options.idleEvictionMs ?? 36e5;
|
|
685
|
+
this.now = options.now ?? Date.now;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Retain one snapshot. `processes` is stored by reference — the payload is
|
|
689
|
+
* already an immutable arrival off the bus, and copying it would double the
|
|
690
|
+
* measured cost for nothing.
|
|
691
|
+
*
|
|
692
|
+
* Returns whether the sample was ACCEPTED — that is, whether it was new
|
|
693
|
+
* rather than a replay of a timestamp this node has already delivered.
|
|
694
|
+
*
|
|
695
|
+
* The return value is not diagnostics. It is the idempotence gate the
|
|
696
|
+
* DURABLE tier rides on this return value (`node-metrics-history-recorder.ts`):
|
|
697
|
+
* only an accepted sample is sent to device-history. The gate is one monotonic
|
|
698
|
+
* comparison in memory.
|
|
699
|
+
*/
|
|
700
|
+
record(nodeId, atMs, processes) {
|
|
701
|
+
if (nodeId.length === 0) return false;
|
|
702
|
+
this.sweepIdle();
|
|
703
|
+
let partition = this.partitions.get(nodeId);
|
|
704
|
+
if (partition === void 0) {
|
|
705
|
+
partition = new LoadPartition(this.samplesPerNode);
|
|
706
|
+
this.partitions.set(nodeId, partition);
|
|
707
|
+
}
|
|
708
|
+
const outcome = partition.push({
|
|
709
|
+
atMs,
|
|
710
|
+
processes
|
|
711
|
+
});
|
|
712
|
+
if (!outcome.accepted) {
|
|
713
|
+
if (partition.size() === 0) this.partitions.delete(nodeId);
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
this.totalRows += outcome.rowDelta;
|
|
717
|
+
this.lastWriteSeq.set(nodeId, ++this.writeSeq);
|
|
718
|
+
if (this.partitions.size > this.maxNodes) this.evictPartitions(this.partitions.size - this.maxNodes, nodeId);
|
|
719
|
+
this.enforceRowBudget();
|
|
720
|
+
return true;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Read one node's retained series, oldest-first.
|
|
724
|
+
*
|
|
725
|
+
* `sinceMs` is EXCLUSIVE: a caller passes the newest timestamp it already
|
|
726
|
+
* holds and gets back only what it is missing. That is the whole contract
|
|
727
|
+
* that lets the admin UI seed from here and then continue live without
|
|
728
|
+
* doubling a point it already drew.
|
|
729
|
+
*
|
|
730
|
+
* A node nobody has recorded answers with an empty series, not an error —
|
|
731
|
+
* unknown is the truth about a node that has not reported.
|
|
732
|
+
*/
|
|
733
|
+
read(nodeId, sinceMs) {
|
|
734
|
+
this.sweepIdle();
|
|
735
|
+
const partition = this.partitions.get(nodeId);
|
|
736
|
+
if (partition === void 0) return {
|
|
737
|
+
nodeId,
|
|
738
|
+
samples: [],
|
|
739
|
+
retainedSamples: 0,
|
|
740
|
+
oldestAtMs: null,
|
|
741
|
+
capacity: this.samplesPerNode
|
|
742
|
+
};
|
|
743
|
+
return {
|
|
744
|
+
nodeId,
|
|
745
|
+
samples: partition.list(sinceMs),
|
|
746
|
+
retainedSamples: partition.size(),
|
|
747
|
+
oldestAtMs: partition.oldestAtMs(),
|
|
748
|
+
capacity: this.samplesPerNode
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
/** Node ids with a live partition. Observability for the fleet bound. */
|
|
752
|
+
nodeIds() {
|
|
753
|
+
return [...this.partitions.keys()];
|
|
754
|
+
}
|
|
755
|
+
/** Process rows retained across every partition — the number that IS memory. */
|
|
756
|
+
rowCount() {
|
|
757
|
+
return this.totalRows;
|
|
758
|
+
}
|
|
759
|
+
/** Samples retained across every partition. */
|
|
760
|
+
sampleCount() {
|
|
761
|
+
let total = 0;
|
|
762
|
+
for (const partition of this.partitions.values()) total += partition.size();
|
|
763
|
+
return total;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Drop partitions whose newest sample is older than the retention window.
|
|
767
|
+
*
|
|
768
|
+
* Lazy, on write and on read — never a timer. A timer would be a new
|
|
769
|
+
* periodic cost in a subsystem whose entire premise is that it adds none,
|
|
770
|
+
* and a ring that nobody writes to and nobody reads is not growing either.
|
|
771
|
+
*/
|
|
772
|
+
sweepIdle() {
|
|
773
|
+
const cutoff = this.now() - this.idleEvictionMs;
|
|
774
|
+
for (const [nodeId, partition] of [...this.partitions.entries()]) {
|
|
775
|
+
const lastWrite = partition.lastWriteAtMs();
|
|
776
|
+
if (lastWrite !== null && lastWrite > cutoff) continue;
|
|
777
|
+
this.dropPartition(nodeId);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Bring the fleet back under the row budget by dropping the OLDEST sample of
|
|
782
|
+
* the HEAVIEST partition, repeatedly.
|
|
783
|
+
*
|
|
784
|
+
* Terminates: every iteration removes one sample from a non-empty partition,
|
|
785
|
+
* and the population of samples is finite and strictly decreasing.
|
|
786
|
+
*/
|
|
787
|
+
enforceRowBudget() {
|
|
788
|
+
while (this.totalRows > this.maxTotalProcessRows) {
|
|
789
|
+
const victim = this.heaviestPartition();
|
|
790
|
+
if (victim === null) return;
|
|
791
|
+
const [nodeId, partition] = victim;
|
|
792
|
+
this.totalRows -= partition.dropOldest();
|
|
793
|
+
if (partition.size() === 0) this.dropPartition(nodeId);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
heaviestPartition() {
|
|
797
|
+
let best = null;
|
|
798
|
+
for (const entry of this.partitions.entries()) {
|
|
799
|
+
if (entry[1].size() === 0) continue;
|
|
800
|
+
if (best === null || entry[1].rowCount() > best[1].rowCount()) best = entry;
|
|
801
|
+
}
|
|
802
|
+
return best;
|
|
803
|
+
}
|
|
804
|
+
/** Drop `count` whole partitions, least-recently-written first. */
|
|
805
|
+
evictPartitions(count, protectedNodeId) {
|
|
806
|
+
const order = [...this.partitions.keys()].filter((nodeId) => nodeId !== protectedNodeId).toSorted((a, b) => (this.lastWriteSeq.get(a) ?? 0) - (this.lastWriteSeq.get(b) ?? 0));
|
|
807
|
+
let remaining = count;
|
|
808
|
+
for (const nodeId of order) {
|
|
809
|
+
if (remaining <= 0) return;
|
|
810
|
+
this.dropPartition(nodeId);
|
|
811
|
+
remaining -= 1;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
/** Remove a partition and everything that indexes it. */
|
|
815
|
+
dropPartition(nodeId) {
|
|
816
|
+
const partition = this.partitions.get(nodeId);
|
|
817
|
+
if (partition === void 0) return;
|
|
818
|
+
this.totalRows -= partition.rowCount();
|
|
819
|
+
this.partitions.delete(nodeId);
|
|
820
|
+
this.lastWriteSeq.delete(nodeId);
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
var CONTAINER_MEMORY_MAX_TOTAL_ROWS = 2880;
|
|
824
|
+
var ContainerMemoryRing = class {
|
|
825
|
+
ring;
|
|
826
|
+
constructor(options = {}) {
|
|
827
|
+
this.ring = new NodeLoadRing({
|
|
828
|
+
samplesPerNode: options.samplesPerNode ?? 180,
|
|
829
|
+
maxTotalProcessRows: CONTAINER_MEMORY_MAX_TOTAL_ROWS,
|
|
830
|
+
...options.now !== void 0 ? { now: options.now } : {}
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
record(nodeId, atMs, snapshot) {
|
|
834
|
+
return this.ring.record(nodeId, atMs, [snapshot]);
|
|
835
|
+
}
|
|
836
|
+
read(nodeId, sinceMs) {
|
|
837
|
+
const series = this.ring.read(nodeId, sinceMs);
|
|
838
|
+
const out = [];
|
|
839
|
+
for (const sample of series.samples) {
|
|
840
|
+
const snapshot = sample.processes[0];
|
|
841
|
+
if (snapshot === void 0) continue;
|
|
842
|
+
out.push({
|
|
843
|
+
...snapshot,
|
|
844
|
+
atMs: sample.atMs
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
return out;
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
function reduceContainerMemory(points, bucketMs, origin) {
|
|
851
|
+
if (bucketMs <= 0 || points.length === 0) return points;
|
|
852
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
853
|
+
for (const point of points) {
|
|
854
|
+
const start = origin + Math.floor((point.atMs - origin) / bucketMs) * bucketMs;
|
|
855
|
+
const held = buckets.get(start);
|
|
856
|
+
if (held === void 0 || point.currentBytes > held.currentBytes) buckets.set(start, {
|
|
857
|
+
...point,
|
|
858
|
+
atMs: start
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
862
|
+
}
|
|
863
|
+
function mergeContainerMemory(cold, hot) {
|
|
864
|
+
const byAt = /* @__PURE__ */ new Map();
|
|
865
|
+
for (const point of cold) byAt.set(point.atMs, point);
|
|
866
|
+
for (const point of hot) byAt.set(point.atMs, point);
|
|
867
|
+
return [...byAt.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
868
|
+
}
|
|
869
|
+
var DEFAULT_MAX_ROWS = 5e5;
|
|
870
|
+
/** Why a value was refused — the message an operator is shown verbatim. */
|
|
871
|
+
var LoadSeriesConfigError = class extends Error {
|
|
872
|
+
constructor(message) {
|
|
873
|
+
super(message);
|
|
874
|
+
this.name = "LoadSeriesConfigError";
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
function requireInteger(value, field) {
|
|
878
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
879
|
+
if (!Number.isFinite(n)) throw new LoadSeriesConfigError(`${field} must be a number, received ${String(value)}`);
|
|
880
|
+
return Math.round(n);
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Resolve the configuration, REFUSING anything out of range.
|
|
884
|
+
*
|
|
885
|
+
* An ABSENT field takes its default — that is not a refusal, it is a document
|
|
886
|
+
* that has never been written. A PRESENT field outside its bounds throws.
|
|
887
|
+
*/
|
|
888
|
+
function resolveLoadSeriesConfig(raw) {
|
|
889
|
+
let cadenceSec = 10;
|
|
890
|
+
if (raw.loadSeriesCadenceSec !== void 0 && raw.loadSeriesCadenceSec !== null) {
|
|
891
|
+
cadenceSec = requireInteger(raw.loadSeriesCadenceSec, "loadSeriesCadenceSec");
|
|
892
|
+
if (cadenceSec < 5 || cadenceSec > 60) throw new LoadSeriesConfigError(`load series cadence must be between 5 and 60 seconds — refused ${cadenceSec}`);
|
|
893
|
+
}
|
|
894
|
+
let retentionHours = 6;
|
|
895
|
+
if (raw.loadSeriesRetentionHours !== void 0 && raw.loadSeriesRetentionHours !== null) {
|
|
896
|
+
retentionHours = requireInteger(raw.loadSeriesRetentionHours, "loadSeriesRetentionHours");
|
|
897
|
+
if (retentionHours < 1 || retentionHours > 72) throw new LoadSeriesConfigError(`load series retention must be between 1 and 72 hours — refused ${retentionHours}`);
|
|
898
|
+
}
|
|
899
|
+
return {
|
|
900
|
+
cadenceSec,
|
|
901
|
+
retentionHours,
|
|
902
|
+
maxRows: DEFAULT_MAX_ROWS
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Project the cost of a configuration from the numbers the cluster is actually
|
|
907
|
+
* reporting — nodes and processes OBSERVED, never a constant.
|
|
908
|
+
*
|
|
909
|
+
* This is what makes the knob honest: an operator raising retention to three
|
|
910
|
+
* days sees the row count and the megabytes BEFORE applying it, rather than
|
|
911
|
+
* discovering them afterwards. `MEASURED_BYTES_PER_ROW` is measured, not
|
|
912
|
+
* guessed — see `node-metrics-history-recorder.ts`.
|
|
913
|
+
*/
|
|
914
|
+
function projectLoadSeriesCost(input) {
|
|
915
|
+
const samplesPerNodeWindow = input.config.retentionHours * 3600 / input.config.cadenceSec;
|
|
916
|
+
const intendedRows = Math.round(samplesPerNodeWindow * Math.max(input.observedProcessRows, 0));
|
|
917
|
+
const boundedRows = Math.min(intendedRows, input.config.maxRows);
|
|
918
|
+
return {
|
|
919
|
+
intendedRows,
|
|
920
|
+
boundedRows,
|
|
921
|
+
estimatedBytes: boundedRows * 87,
|
|
922
|
+
capBites: intendedRows > input.config.maxRows
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
/** Human-readable one-liner for the settings form. */
|
|
926
|
+
function describeLoadSeriesCost(projection) {
|
|
927
|
+
const mib = (projection.estimatedBytes / 1048576).toFixed(1);
|
|
928
|
+
const rows = projection.intendedRows.toLocaleString("en-US");
|
|
929
|
+
const capped = projection.boundedRows.toLocaleString("en-US");
|
|
930
|
+
if (!projection.capBites) return `This configuration retains ~${rows} rows ≈ ${mib} MiB on the hub database (NVMe cache), measured at 87 bytes per row.`;
|
|
931
|
+
return `This configuration WANTS ~${rows} rows, above the ${projection.boundedRows.toLocaleString("en-US")}-row hard cap. The table will hold ~${capped} rows ≈ ${mib} MiB and the OLDEST samples will be evicted, so the effective window is shorter than the retention you asked for.`;
|
|
932
|
+
}
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region src/builtins/native-metrics/load-series-reader.ts
|
|
935
|
+
/**
|
|
936
|
+
* The ONE reader over both retention tiers.
|
|
937
|
+
*
|
|
938
|
+
* The hot window is the in-memory ring; the cold one is device-history raw
|
|
939
|
+
* points. A caller never learns which tier a point came
|
|
940
|
+
* from, and that is a hard requirement rather than a nicety: a second reader
|
|
941
|
+
* is how two charts start disagreeing about the same node, and it is how "the
|
|
942
|
+
* ring says X, the table says Y" becomes a question nobody can answer.
|
|
943
|
+
*
|
|
944
|
+
* Three things happen here, in this order, and each one is load-bearing:
|
|
945
|
+
*
|
|
946
|
+
* 1. **Merge and dedupe on `atMs`.** The two tiers OVERLAP by construction —
|
|
947
|
+
* the ring holds the last 180 snapshots and the table holds every snapshot
|
|
948
|
+
* the ring accepted, including those same 180. A snapshot present in both
|
|
949
|
+
* must contribute exactly once. Identity is `atMs`, because one node emits
|
|
950
|
+
* one snapshot per tick and a timestamp already held IS that snapshot. The
|
|
951
|
+
* HOT copy wins on a tie: it is the payload as it arrived, while the cold
|
|
952
|
+
* one has been through the storage encode.
|
|
953
|
+
* 2. **Fold per function.** The chart draws one series per addon, so the fold
|
|
954
|
+
* happens here rather than in the browser.
|
|
955
|
+
* 3. **Reduce, preserving the extremes.** See `load-series-fold.ts` for why
|
|
956
|
+
* the representative of a bucket is its MAX and never its mean.
|
|
957
|
+
*
|
|
958
|
+
* A GAP stays a gap through all three. Emission is fixed-cadence, so a missing
|
|
959
|
+
* interval means one thing — nobody reported — and nothing here fills it in.
|
|
960
|
+
*/
|
|
961
|
+
/**
|
|
962
|
+
* Merge the two tiers into one deduped, oldest-first list of samples.
|
|
963
|
+
*
|
|
964
|
+
* Exported because the dedup is the property worth testing on its own: a
|
|
965
|
+
* doubled point is invisible in a total and obvious only as a chart that reads
|
|
966
|
+
* twice as loud as the machine.
|
|
967
|
+
*/
|
|
968
|
+
function mergeSamples(cold, hot) {
|
|
969
|
+
const byAt = /* @__PURE__ */ new Map();
|
|
970
|
+
for (const sample of cold) byAt.set(sample.atMs, sample);
|
|
971
|
+
for (const sample of hot) byAt.set(sample.atMs, sample);
|
|
972
|
+
return [...byAt.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
973
|
+
}
|
|
974
|
+
/** `RetainedProcess` is already the fold's row shape — named, not re-derived. */
|
|
975
|
+
function toFoldRows(processes) {
|
|
976
|
+
return processes;
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Merge, fold and reduce. The whole read path in one pure function, so every
|
|
980
|
+
* property that matters — dedup, peak survival, an empty bucket staying empty
|
|
981
|
+
* — is testable without a database or a ring.
|
|
982
|
+
*/
|
|
983
|
+
function mergeLoadSeries(input) {
|
|
984
|
+
const samples = mergeSamples(input.cold, input.hot);
|
|
985
|
+
if (samples.length === 0) return {
|
|
986
|
+
series: [],
|
|
987
|
+
bucketMs: input.cadenceMs,
|
|
988
|
+
retainedSamples: 0,
|
|
989
|
+
oldestAtMs: null
|
|
990
|
+
};
|
|
991
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
992
|
+
for (const sample of samples) for (const bucket of require_dist.foldSnapshotByFunction(toFoldRows(sample.processes), sample.atMs)) {
|
|
993
|
+
const held = byKey.get(bucket.key);
|
|
994
|
+
if (held === void 0) byKey.set(bucket.key, {
|
|
995
|
+
kind: bucket.kind,
|
|
996
|
+
points: [bucket.point]
|
|
997
|
+
});
|
|
998
|
+
else held.points.push(bucket.point);
|
|
999
|
+
}
|
|
1000
|
+
const oldestAtMs = samples[0]?.atMs ?? null;
|
|
1001
|
+
const newestAtMs = samples.at(-1)?.atMs ?? oldestAtMs;
|
|
1002
|
+
const spanMs = oldestAtMs === null || newestAtMs === null ? 0 : newestAtMs - oldestAtMs + input.cadenceMs;
|
|
1003
|
+
const bucketMs = input.maxPoints === void 0 ? input.cadenceMs : require_dist.resolveBucketMs(spanMs, input.cadenceMs, input.maxPoints);
|
|
1004
|
+
const origin = oldestAtMs ?? 0;
|
|
1005
|
+
const series = [...byKey.entries()].map(([key, held]) => ({
|
|
1006
|
+
key,
|
|
1007
|
+
kind: held.kind,
|
|
1008
|
+
points: bucketMs > input.cadenceMs ? require_dist.reducePoints(held.points, bucketMs, origin) : held.points
|
|
1009
|
+
}));
|
|
1010
|
+
const weight = (s) => {
|
|
1011
|
+
const last = s.points.at(-1);
|
|
1012
|
+
if (last === void 0) return -1;
|
|
1013
|
+
if (last.cpuMainPercent !== null && last.cpuGcPercent !== null) return last.cpuMainPercent + last.cpuGcPercent;
|
|
1014
|
+
return last.cpuLifetimePercent;
|
|
1015
|
+
};
|
|
1016
|
+
return {
|
|
1017
|
+
series: series.toSorted((a, b) => {
|
|
1018
|
+
const d = weight(b) - weight(a);
|
|
1019
|
+
return d !== 0 ? d : a.key.localeCompare(b.key);
|
|
1020
|
+
}),
|
|
1021
|
+
bucketMs,
|
|
1022
|
+
retainedSamples: samples.length,
|
|
1023
|
+
oldestAtMs
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
//#endregion
|
|
1027
|
+
//#region src/builtins/native-metrics/node-metrics-history-recorder.ts
|
|
1028
|
+
/**
|
|
1029
|
+
* Node load history via device-history (D850, LTS P4) — hub only: the hub's
|
|
1030
|
+
* bus carries every node's snapshots, so the hub's writer is the cluster's.
|
|
1031
|
+
*
|
|
1032
|
+
* Per RUNNER, never per PID. A series was once scoped by process id, and a pid
|
|
1033
|
+
* changes on every runner restart: the hub held ~11.8k node series, most of
|
|
1034
|
+
* them one restart long, and no chart could follow a runner across a respawn.
|
|
1035
|
+
* The scope is now the fold's own function key (`load-series-fold.ts`): the
|
|
1036
|
+
* runner's addon id, or `__root__` / `__unattributed__`, so a runner keeps ONE
|
|
1037
|
+
* series for life and the cold tier folds exactly like the hot ring. The old
|
|
1038
|
+
* `process-*` keys are no longer written; their rows age out by retention.
|
|
1039
|
+
*
|
|
1040
|
+
* Node TOTALS ride the resources snapshot: CPU %, memory %, CPU temperature
|
|
1041
|
+
* and, when the node has one, GPU utilisation and temperature. A reading the
|
|
1042
|
+
* node did not take (`null`) is no point — never 0 (D393).
|
|
1043
|
+
*
|
|
1044
|
+
* The in-memory rings still serve the last hour for charts.
|
|
1045
|
+
*/
|
|
1046
|
+
var ADDON_ID = "metrics-native";
|
|
1047
|
+
var MIB = 1048576;
|
|
1048
|
+
function keyOf(name) {
|
|
1049
|
+
return `addon:${ADDON_ID}/${name}`;
|
|
1050
|
+
}
|
|
1051
|
+
/** Per-runner series (scope = the fold key). */
|
|
1052
|
+
var RUNNER_CPU_MAIN_KEY = keyOf("runner-cpu-main-percent");
|
|
1053
|
+
var RUNNER_CPU_GC_KEY = keyOf("runner-cpu-gc-percent");
|
|
1054
|
+
var RUNNER_CPU_LIFETIME_KEY = keyOf("runner-cpu-lifetime-percent");
|
|
1055
|
+
var RUNNER_RSS_KEY = keyOf("runner-rss-mib");
|
|
1056
|
+
var RUNNER_PROCESSES_KEY = keyOf("runner-processes");
|
|
1057
|
+
/** Node totals (scope ''). */
|
|
1058
|
+
var NODE_CPU_KEY = keyOf("node-cpu-percent");
|
|
1059
|
+
var NODE_MEMORY_KEY = keyOf("node-memory-percent");
|
|
1060
|
+
var NODE_CPU_TEMPERATURE_KEY = keyOf("node-cpu-temperature");
|
|
1061
|
+
var NODE_GPU_KEY = keyOf("node-gpu-percent");
|
|
1062
|
+
var NODE_GPU_TEMPERATURE_KEY = keyOf("node-gpu-temperature");
|
|
1063
|
+
var NODE_CONTAINER_CURRENT_KEY = keyOf("container-current-mib");
|
|
1064
|
+
keyOf("process-cpu-percent");
|
|
1065
|
+
keyOf("process-rss-mib");
|
|
1066
|
+
/**
|
|
1067
|
+
* The per-runner series are downsampled to device-history's point cadence:
|
|
1068
|
+
* one point per series per this many ms, sustained. Process snapshots arrive
|
|
1069
|
+
* at the load-series cadence (5–60 s, `load-series-config.ts`), and at 5 s
|
|
1070
|
+
* writing each one has every other batch refused whole for `rate`.
|
|
1071
|
+
*
|
|
1072
|
+
* These two numbers MIRROR `RECORD_MIN_INTERVAL_MS` / `RECORD_RATE_SLACK_MS`
|
|
1073
|
+
* of the ingest door (`device-history/ingest/producer-ingest.ts`) — a builtin
|
|
1074
|
+
* does not import another — and `node-metrics-history-cadence.spec.ts` pins
|
|
1075
|
+
* them equal, so the door moving fails a spec instead of a day of history.
|
|
1076
|
+
*/
|
|
1077
|
+
var RUNNER_SAMPLE_MIN_INTERVAL_MS = 1e4;
|
|
1078
|
+
var RUNNER_SAMPLE_RATE_SLACK_MS = 1e3;
|
|
1079
|
+
/** True when the door would take a point at `ts` after `slot`. */
|
|
1080
|
+
function sampleIsDue(slot, ts) {
|
|
1081
|
+
if (slot === void 0 || ts < slot.lastTs) return true;
|
|
1082
|
+
return ts >= slot.nextDue - RUNNER_SAMPLE_RATE_SLACK_MS;
|
|
1083
|
+
}
|
|
1084
|
+
/** The slot after a batch at `ts` was accepted — the door's own grid rule. */
|
|
1085
|
+
function nextSampleSlot(slot, ts) {
|
|
1086
|
+
if (slot === void 0) return {
|
|
1087
|
+
lastTs: ts,
|
|
1088
|
+
nextDue: ts + RUNNER_SAMPLE_MIN_INTERVAL_MS
|
|
1089
|
+
};
|
|
1090
|
+
if (ts < slot.lastTs) return slot;
|
|
1091
|
+
return {
|
|
1092
|
+
lastTs: ts,
|
|
1093
|
+
nextDue: Math.max(slot.nextDue, ts) + RUNNER_SAMPLE_MIN_INTERVAL_MS
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
var DECLARATIONS = [
|
|
1097
|
+
{
|
|
1098
|
+
name: "runner-cpu-main-percent",
|
|
1099
|
+
displayName: "Runner CPU % (main thread)",
|
|
1100
|
+
unit: "%"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
name: "runner-cpu-gc-percent",
|
|
1104
|
+
displayName: "Runner CPU % (GC)",
|
|
1105
|
+
unit: "%"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
name: "runner-cpu-lifetime-percent",
|
|
1109
|
+
displayName: "Runner CPU % (lifetime average)",
|
|
1110
|
+
unit: "%"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
name: "runner-rss-mib",
|
|
1114
|
+
displayName: "Runner RSS (MiB)",
|
|
1115
|
+
unit: "MiB"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: "runner-processes",
|
|
1119
|
+
displayName: "Runner processes",
|
|
1120
|
+
unit: "count"
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
name: "node-cpu-percent",
|
|
1124
|
+
displayName: "Node CPU %",
|
|
1125
|
+
unit: "%"
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
name: "node-memory-percent",
|
|
1129
|
+
displayName: "Node memory %",
|
|
1130
|
+
unit: "%"
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
name: "node-cpu-temperature",
|
|
1134
|
+
displayName: "Node CPU temperature",
|
|
1135
|
+
unit: "°C"
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
name: "node-gpu-percent",
|
|
1139
|
+
displayName: "Node GPU %",
|
|
1140
|
+
unit: "%"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
name: "node-gpu-temperature",
|
|
1144
|
+
displayName: "Node GPU temperature",
|
|
1145
|
+
unit: "°C"
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: "container-current-mib",
|
|
1149
|
+
displayName: "Container memory current (MiB)",
|
|
1150
|
+
unit: "MiB"
|
|
1151
|
+
}
|
|
1152
|
+
];
|
|
1153
|
+
function nodeMetricsHistoryClient(api) {
|
|
1154
|
+
return {
|
|
1155
|
+
declareSeries: (input) => api.declareSeries.mutate(input),
|
|
1156
|
+
record: (input) => api.record.mutate({ points: [...input.points] }),
|
|
1157
|
+
queryNode: async (input) => {
|
|
1158
|
+
return { series: (await api.queryNode.query({ ...input })).series.map((s) => ({
|
|
1159
|
+
scope: s.scope,
|
|
1160
|
+
points: s.points.map((p) => ({
|
|
1161
|
+
t: p.t,
|
|
1162
|
+
samples: p.samples,
|
|
1163
|
+
value: p.last ?? p.mean
|
|
1164
|
+
}))
|
|
1165
|
+
})) };
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
function refusalCounts(result) {
|
|
1170
|
+
const counts = {};
|
|
1171
|
+
for (const r of result.refused) counts[r.reason] = (counts[r.reason] ?? 0) + r.count;
|
|
1172
|
+
return counts;
|
|
1173
|
+
}
|
|
1174
|
+
/** The fold's function key of a process: the same rule as `foldSnapshotByFunction`. */
|
|
1175
|
+
function runnerScopeOf(process) {
|
|
1176
|
+
if (process.addonId !== null) return process.addonId;
|
|
1177
|
+
return process.classification === "root" ? require_dist.ROOT_BUCKET_KEY : require_dist.UNATTRIBUTED_BUCKET_KEY;
|
|
1178
|
+
}
|
|
1179
|
+
function round1(value) {
|
|
1180
|
+
return Math.round(value * 10) / 10;
|
|
1181
|
+
}
|
|
1182
|
+
var NodeMetricsHistoryRecorder = class {
|
|
1183
|
+
deps;
|
|
1184
|
+
declared = false;
|
|
1185
|
+
lastTotalsAt = /* @__PURE__ */ new Map();
|
|
1186
|
+
/** Per node: the door's slot for the per-runner batch (see {@link sampleIsDue}). */
|
|
1187
|
+
sampleSlots = /* @__PURE__ */ new Map();
|
|
1188
|
+
/** A not-ready skip was logged and device-history has not been ready since. */
|
|
1189
|
+
waitLogged = false;
|
|
1190
|
+
constructor(deps) {
|
|
1191
|
+
this.deps = deps;
|
|
1192
|
+
}
|
|
1193
|
+
async declare() {
|
|
1194
|
+
if (this.declared) return;
|
|
1195
|
+
for (const d of DECLARATIONS) await this.deps.deviceHistory.declareSeries({
|
|
1196
|
+
name: d.name,
|
|
1197
|
+
subjectKind: "node",
|
|
1198
|
+
kind: "gauge",
|
|
1199
|
+
displayName: d.displayName,
|
|
1200
|
+
ingest: "points",
|
|
1201
|
+
unit: d.unit
|
|
1202
|
+
});
|
|
1203
|
+
this.declared = true;
|
|
1204
|
+
}
|
|
1205
|
+
/** One process snapshot: per-runner sums plus the container's memory. */
|
|
1206
|
+
async recordSample(nodeId, atMs, processes, containerMemory) {
|
|
1207
|
+
if (!sampleIsDue(this.sampleSlots.get(nodeId), atMs)) return;
|
|
1208
|
+
const subject = {
|
|
1209
|
+
kind: "node",
|
|
1210
|
+
nodeId
|
|
1211
|
+
};
|
|
1212
|
+
const point = (key, scope, value) => ({
|
|
1213
|
+
key,
|
|
1214
|
+
subject,
|
|
1215
|
+
scope,
|
|
1216
|
+
ts: atMs,
|
|
1217
|
+
value
|
|
1218
|
+
});
|
|
1219
|
+
const byRunner = /* @__PURE__ */ new Map();
|
|
1220
|
+
for (const p of processes) {
|
|
1221
|
+
const scope = runnerScopeOf(p);
|
|
1222
|
+
const t = byRunner.get(scope) ?? {
|
|
1223
|
+
main: 0,
|
|
1224
|
+
gc: 0,
|
|
1225
|
+
splitKnown: true,
|
|
1226
|
+
lifetime: 0,
|
|
1227
|
+
rss: 0,
|
|
1228
|
+
count: 0
|
|
1229
|
+
};
|
|
1230
|
+
const known = p.cpuMainPercent !== null && p.cpuGcPercent !== null;
|
|
1231
|
+
byRunner.set(scope, {
|
|
1232
|
+
main: t.main + (p.cpuMainPercent ?? 0),
|
|
1233
|
+
gc: t.gc + (p.cpuGcPercent ?? 0),
|
|
1234
|
+
splitKnown: t.splitKnown && known,
|
|
1235
|
+
lifetime: t.lifetime + p.cpuPercent,
|
|
1236
|
+
rss: t.rss + p.memoryRssBytes,
|
|
1237
|
+
count: t.count + 1
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
const points = [];
|
|
1241
|
+
for (const [scope, t] of byRunner) {
|
|
1242
|
+
if (t.splitKnown) {
|
|
1243
|
+
points.push(point(RUNNER_CPU_MAIN_KEY, scope, round1(t.main)));
|
|
1244
|
+
points.push(point(RUNNER_CPU_GC_KEY, scope, round1(t.gc)));
|
|
1245
|
+
}
|
|
1246
|
+
points.push(point(RUNNER_CPU_LIFETIME_KEY, scope, round1(t.lifetime)));
|
|
1247
|
+
points.push(point(RUNNER_RSS_KEY, scope, Math.round(t.rss / MIB)));
|
|
1248
|
+
points.push(point(RUNNER_PROCESSES_KEY, scope, t.count));
|
|
1249
|
+
}
|
|
1250
|
+
if (containerMemory !== null) points.push(point(NODE_CONTAINER_CURRENT_KEY, "", Math.round(containerMemory.currentBytes / MIB)));
|
|
1251
|
+
if (await this.write(nodeId, atMs, points) > 0) this.sampleSlots.set(nodeId, nextSampleSlot(this.sampleSlots.get(nodeId), atMs));
|
|
1252
|
+
}
|
|
1253
|
+
/** One resources snapshot: the node's totals, at most every {@link NODE_TOTALS_MIN_INTERVAL_MS}. */
|
|
1254
|
+
async recordTotals(nodeId, atMs, snapshot) {
|
|
1255
|
+
const last = this.lastTotalsAt.get(nodeId);
|
|
1256
|
+
if (last !== void 0 && atMs >= last && atMs - last < 15e3) return;
|
|
1257
|
+
this.lastTotalsAt.set(nodeId, atMs);
|
|
1258
|
+
const subject = {
|
|
1259
|
+
kind: "node",
|
|
1260
|
+
nodeId
|
|
1261
|
+
};
|
|
1262
|
+
const points = [];
|
|
1263
|
+
const add = (key, value) => {
|
|
1264
|
+
if (value === null || !Number.isFinite(value)) return;
|
|
1265
|
+
points.push({
|
|
1266
|
+
key,
|
|
1267
|
+
subject,
|
|
1268
|
+
scope: "",
|
|
1269
|
+
ts: atMs,
|
|
1270
|
+
value: round1(value)
|
|
1271
|
+
});
|
|
1272
|
+
};
|
|
1273
|
+
add(NODE_CPU_KEY, snapshot.cpu.total);
|
|
1274
|
+
add(NODE_MEMORY_KEY, snapshot.memory.percent);
|
|
1275
|
+
add(NODE_CPU_TEMPERATURE_KEY, snapshot.cpuTemperature);
|
|
1276
|
+
add(NODE_GPU_KEY, snapshot.gpu?.utilization ?? null);
|
|
1277
|
+
add(NODE_GPU_TEMPERATURE_KEY, snapshot.gpu?.temperature ?? null);
|
|
1278
|
+
await this.write(nodeId, atMs, points);
|
|
1279
|
+
}
|
|
1280
|
+
async write(nodeId, atMs, points) {
|
|
1281
|
+
if (points.length === 0) return 0;
|
|
1282
|
+
if (!await this.ensureDeclared()) return 0;
|
|
1283
|
+
try {
|
|
1284
|
+
const result = await this.deps.deviceHistory.record({ points });
|
|
1285
|
+
if (result.refused.length > 0) {
|
|
1286
|
+
if (result.refused.some((r) => r.reason === "undeclared")) this.declared = false;
|
|
1287
|
+
this.deps.logger.warn("node metrics history points refused", { meta: {
|
|
1288
|
+
nodeId,
|
|
1289
|
+
accepted: result.accepted,
|
|
1290
|
+
refused: refusalCounts(result)
|
|
1291
|
+
} });
|
|
1292
|
+
}
|
|
1293
|
+
return result.accepted;
|
|
1294
|
+
} catch (err) {
|
|
1295
|
+
this.deps.logger.warn("node metrics history sample not stored", { meta: {
|
|
1296
|
+
nodeId,
|
|
1297
|
+
atMs,
|
|
1298
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1299
|
+
} });
|
|
1300
|
+
return 0;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
async readContainerPoints(nodeId, sinceMs, maxPoints) {
|
|
1304
|
+
if (!await this.ensureDeclared()) return [];
|
|
1305
|
+
const result = await this.deps.deviceHistory.queryNode({
|
|
1306
|
+
forNodeId: nodeId,
|
|
1307
|
+
key: NODE_CONTAINER_CURRENT_KEY,
|
|
1308
|
+
from: sinceMs + 1,
|
|
1309
|
+
to: Date.now(),
|
|
1310
|
+
resolution: "raw",
|
|
1311
|
+
maxPoints
|
|
1312
|
+
});
|
|
1313
|
+
const out = [];
|
|
1314
|
+
for (const s of result.series) for (const p of s.points) {
|
|
1315
|
+
if (p.value === null || !Number.isFinite(p.value)) continue;
|
|
1316
|
+
out.push({
|
|
1317
|
+
atMs: p.t,
|
|
1318
|
+
source: "cgroup-v2",
|
|
1319
|
+
currentBytes: p.value * MIB,
|
|
1320
|
+
limitBytes: null,
|
|
1321
|
+
anonBytes: null,
|
|
1322
|
+
fileBytes: null,
|
|
1323
|
+
shmemBytes: null,
|
|
1324
|
+
slabBytes: null,
|
|
1325
|
+
gpuShmemBytes: null
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
return out.toSorted((a, b) => a.atMs - b.atMs);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* The cold tier as process samples the fold reads like the hot ring's. A
|
|
1332
|
+
* runner's sums come back as `processes` equal rows (sums preserved, count
|
|
1333
|
+
* right); its CPU split is `null` where it was not recorded.
|
|
1334
|
+
*/
|
|
1335
|
+
async readProcessSamples(nodeId, sinceMs, maxPoints) {
|
|
1336
|
+
if (!await this.ensureDeclared()) return [];
|
|
1337
|
+
const to = Date.now();
|
|
1338
|
+
const read = (key) => this.deps.deviceHistory.queryNode({
|
|
1339
|
+
forNodeId: nodeId,
|
|
1340
|
+
key,
|
|
1341
|
+
from: sinceMs + 1,
|
|
1342
|
+
to,
|
|
1343
|
+
resolution: "raw",
|
|
1344
|
+
maxPoints
|
|
1345
|
+
});
|
|
1346
|
+
const [main, gc, lifetime, rss, count] = await Promise.all([
|
|
1347
|
+
read(RUNNER_CPU_MAIN_KEY),
|
|
1348
|
+
read(RUNNER_CPU_GC_KEY),
|
|
1349
|
+
read(RUNNER_CPU_LIFETIME_KEY),
|
|
1350
|
+
read(RUNNER_RSS_KEY),
|
|
1351
|
+
read(RUNNER_PROCESSES_KEY)
|
|
1352
|
+
]);
|
|
1353
|
+
return assembleRunnerSamples({
|
|
1354
|
+
main,
|
|
1355
|
+
gc,
|
|
1356
|
+
lifetime,
|
|
1357
|
+
rss,
|
|
1358
|
+
count
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
async ensureDeclared() {
|
|
1362
|
+
if (this.deps.historyReady !== void 0 && !this.deps.historyReady()) {
|
|
1363
|
+
if (!this.waitLogged) {
|
|
1364
|
+
this.waitLogged = true;
|
|
1365
|
+
this.deps.logger.info("node metrics history waits for device-history — samples until it is ready are not stored");
|
|
1366
|
+
}
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
this.waitLogged = false;
|
|
1370
|
+
try {
|
|
1371
|
+
await this.declare();
|
|
1372
|
+
return true;
|
|
1373
|
+
} catch (err) {
|
|
1374
|
+
this.deps.logger.warn("node metrics history declare failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
1375
|
+
return false;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
/** `atMs -> scope -> value` of one key's answer, finite values only. */
|
|
1380
|
+
function indexAnswer(answer) {
|
|
1381
|
+
const out = /* @__PURE__ */ new Map();
|
|
1382
|
+
for (const s of answer.series) for (const p of s.points) {
|
|
1383
|
+
if (p.value === null || !Number.isFinite(p.value)) continue;
|
|
1384
|
+
const at = out.get(p.t) ?? /* @__PURE__ */ new Map();
|
|
1385
|
+
at.set(s.scope, p.value);
|
|
1386
|
+
out.set(p.t, at);
|
|
1387
|
+
}
|
|
1388
|
+
return out;
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Per-runner cold points back into process rows. A sample exists where the
|
|
1392
|
+
* runner's lifetime CPU and RSS were both recorded (always written together).
|
|
1393
|
+
*/
|
|
1394
|
+
function assembleRunnerSamples(answers) {
|
|
1395
|
+
const main = indexAnswer(answers.main);
|
|
1396
|
+
const gc = indexAnswer(answers.gc);
|
|
1397
|
+
const rss = indexAnswer(answers.rss);
|
|
1398
|
+
const count = indexAnswer(answers.count);
|
|
1399
|
+
const samples = [];
|
|
1400
|
+
for (const [atMs, lifetimeByScope] of indexAnswer(answers.lifetime)) {
|
|
1401
|
+
const processes = [];
|
|
1402
|
+
for (const [scope, lifetime] of lifetimeByScope) {
|
|
1403
|
+
const rssMib = rss.get(atMs)?.get(scope);
|
|
1404
|
+
if (rssMib === void 0) continue;
|
|
1405
|
+
const n = Math.max(1, Math.round(count.get(atMs)?.get(scope) ?? 1));
|
|
1406
|
+
const m = main.get(atMs)?.get(scope);
|
|
1407
|
+
const g = gc.get(atMs)?.get(scope);
|
|
1408
|
+
const split = m !== void 0 && g !== void 0;
|
|
1409
|
+
const isRoot = scope === require_dist.ROOT_BUCKET_KEY;
|
|
1410
|
+
const isUnattributed = scope === require_dist.UNATTRIBUTED_BUCKET_KEY;
|
|
1411
|
+
for (let i = 0; i < n; i += 1) processes.push({
|
|
1412
|
+
pid: 0,
|
|
1413
|
+
addonId: isRoot || isUnattributed ? null : scope,
|
|
1414
|
+
classification: isRoot ? "root" : isUnattributed ? "system" : "managed",
|
|
1415
|
+
cpuPercent: lifetime / n,
|
|
1416
|
+
memoryRssBytes: rssMib * MIB / n,
|
|
1417
|
+
cpuMainPercent: split ? m / n : null,
|
|
1418
|
+
cpuGcPercent: split ? g / n : null
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
if (processes.length > 0) samples.push({
|
|
1422
|
+
atMs,
|
|
1423
|
+
processes
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
return samples.toSorted((a, b) => a.atMs - b.atMs);
|
|
1427
|
+
}
|
|
1428
|
+
//#endregion
|
|
1429
|
+
//#region src/builtins/native-metrics/darwin-memory.ts
|
|
1430
|
+
var PAGE_SIZE_RE = /page size of (\d+) bytes/;
|
|
1431
|
+
function readCounter(output, label) {
|
|
1432
|
+
const match = output.match(new RegExp(`^${label}:\\s+(\\d+)\\.?\\s*$`, "m"));
|
|
1433
|
+
return match ? parseInt(match[1], 10) : null;
|
|
1434
|
+
}
|
|
1435
|
+
/** Parses `vm_stat` output. Returns null when a required counter is missing. */
|
|
1436
|
+
function parseVmStat(output) {
|
|
1437
|
+
const pageSize = parseInt(output.match(PAGE_SIZE_RE)?.[1] ?? "", 10);
|
|
1438
|
+
if (!Number.isFinite(pageSize) || pageSize <= 0) return null;
|
|
1439
|
+
const free = readCounter(output, "Pages free");
|
|
1440
|
+
const inactive = readCounter(output, "Pages inactive");
|
|
1441
|
+
const speculative = readCounter(output, "Pages speculative");
|
|
1442
|
+
const wired = readCounter(output, "Pages wired down");
|
|
1443
|
+
const purgeable = readCounter(output, "Pages purgeable");
|
|
1444
|
+
const anonymous = readCounter(output, "Anonymous pages");
|
|
1445
|
+
const fileBacked = readCounter(output, "File-backed pages");
|
|
1446
|
+
const compressor = readCounter(output, "Pages occupied by compressor");
|
|
1447
|
+
if (free === null || inactive === null || speculative === null || wired === null || purgeable === null || anonymous === null || fileBacked === null || compressor === null) return null;
|
|
1448
|
+
return {
|
|
1449
|
+
pageSize,
|
|
1450
|
+
free,
|
|
1451
|
+
inactive,
|
|
1452
|
+
speculative,
|
|
1453
|
+
wired,
|
|
1454
|
+
purgeable,
|
|
1455
|
+
anonymous,
|
|
1456
|
+
fileBacked,
|
|
1457
|
+
compressor
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
/** used = app + wired + compressed; available = total - used. */
|
|
1461
|
+
function computeDarwinMemory(pages, totalBytes) {
|
|
1462
|
+
if (totalBytes <= 0) return null;
|
|
1463
|
+
const app = Math.max(0, pages.anonymous - pages.purgeable);
|
|
1464
|
+
const usedBytes = Math.min(totalBytes, (app + pages.wired + pages.compressor) * pages.pageSize);
|
|
1465
|
+
return {
|
|
1466
|
+
usedBytes,
|
|
1467
|
+
availableBytes: totalBytes - usedBytes,
|
|
1468
|
+
percent: Math.round(usedBytes / totalBytes * 1e3) / 10
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
//#endregion
|
|
1472
|
+
//#region src/builtins/native-metrics/gpu-probe.ts
|
|
1473
|
+
/**
|
|
1474
|
+
* The Linux GPU probe, forking only when there is something to fork.
|
|
1475
|
+
*
|
|
1476
|
+
* `nvidia-smi` was spawned on every sample — twelve times a minute from
|
|
1477
|
+
* hub-main — on a host with an Intel i915 and no NVIDIA driver. Each spawn
|
|
1478
|
+
* was a synchronous `fork()` of the largest process on the host (D441: p50
|
|
1479
|
+
* 91 ms at 5.8 GB RSS), and each one failed at `exec` and yielded `null`.
|
|
1480
|
+
* Twelve forks a minute bought nothing (D452).
|
|
1481
|
+
*
|
|
1482
|
+
* Whether the binary exists is a question `access(2)` answers on the libuv
|
|
1483
|
+
* pool without a fork. It is asked on EVERY call rather than latched: a handful
|
|
1484
|
+
* of `stat`s every five seconds costs nothing, and a latch is a second fact
|
|
1485
|
+
* about the host that can go stale — the same shape as the caches D224
|
|
1486
|
+
* forbids.
|
|
1487
|
+
*/
|
|
1488
|
+
var nodeAccessCheck = (path) => (0, node_fs_promises.access)(path, node_fs.constants.X_OK);
|
|
1489
|
+
/**
|
|
1490
|
+
* The first `PATH` entry under which `binary` is executable, or `null`.
|
|
1491
|
+
* An empty or missing `PATH` asks nothing.
|
|
1492
|
+
*/
|
|
1493
|
+
async function findOnPath(binary, pathEnv, check = nodeAccessCheck) {
|
|
1494
|
+
const dirs = (pathEnv ?? "").split(":").filter((dir) => dir.length > 0);
|
|
1495
|
+
for (const dir of dirs) {
|
|
1496
|
+
const candidate = `${dir}/${binary}`;
|
|
1497
|
+
try {
|
|
1498
|
+
await check(candidate);
|
|
1499
|
+
return candidate;
|
|
1500
|
+
} catch {}
|
|
1501
|
+
}
|
|
1502
|
+
return null;
|
|
1503
|
+
}
|
|
1504
|
+
var NVIDIA_SMI_ARGS = ["--query-gpu=utilization.gpu,name,memory.used,memory.total,temperature.gpu", "--format=csv,noheader,nounits"];
|
|
1505
|
+
/**
|
|
1506
|
+
* `nvidia-smi`'s one-line CSV as a `MetricsGpuInfo`, or `null` when the
|
|
1507
|
+
* binary is absent, fails, or prints something else. Never throws.
|
|
1508
|
+
*/
|
|
1509
|
+
async function readNvidiaGpu(deps) {
|
|
1510
|
+
const binary = await deps.findOnPath("nvidia-smi");
|
|
1511
|
+
if (binary === null) return null;
|
|
1512
|
+
let stdout;
|
|
1513
|
+
try {
|
|
1514
|
+
stdout = await deps.exec(binary, NVIDIA_SMI_ARGS);
|
|
1515
|
+
} catch {
|
|
1516
|
+
return null;
|
|
1517
|
+
}
|
|
1518
|
+
const parts = stdout.trim().split(",").map((s) => s.trim());
|
|
1519
|
+
if (parts.length < 5) return null;
|
|
1520
|
+
return {
|
|
1521
|
+
utilization: parseInt(parts[0], 10) || 0,
|
|
1522
|
+
model: parts[1] ?? "Unknown GPU",
|
|
1523
|
+
memoryUsedBytes: (parseInt(parts[2], 10) || 0) * 1024 * 1024,
|
|
1524
|
+
memoryTotalBytes: (parseInt(parts[3], 10) || 0) * 1024 * 1024,
|
|
1525
|
+
temperature: parseInt(parts[4], 10) || null
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
//#endregion
|
|
1529
|
+
//#region src/builtins/native-metrics/native-metrics-provider.ts
|
|
1530
|
+
var IS_DARWIN = node_os.platform() === "darwin";
|
|
1531
|
+
var IS_LINUX = node_os.platform() === "linux";
|
|
1532
|
+
var NativeMetricsProvider = class {
|
|
1533
|
+
id = "native";
|
|
1534
|
+
cachedSnapshot = null;
|
|
1535
|
+
samplingTimer = null;
|
|
1536
|
+
macMemTimer = null;
|
|
1537
|
+
prevCpu;
|
|
1538
|
+
diagnostics = null;
|
|
1539
|
+
consecutiveSampleErrors = 0;
|
|
1540
|
+
constructor() {
|
|
1541
|
+
this.prevCpu = aggregateCpuTimes();
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Optional diagnostics sink for sampling errors. The first failure and
|
|
1545
|
+
* every Nth failure thereafter are reported so a permanently-broken
|
|
1546
|
+
* collector doesn't spam logs but is still observable.
|
|
1547
|
+
*/
|
|
1548
|
+
setDiagnostics(diag) {
|
|
1549
|
+
this.diagnostics = diag;
|
|
1550
|
+
}
|
|
1551
|
+
startSampling(intervalMs) {
|
|
1552
|
+
if (IS_DARWIN) {
|
|
1553
|
+
sampleMacMemory(this);
|
|
1554
|
+
this.macMemTimer = setInterval(() => void sampleMacMemory(this), 5e3);
|
|
1555
|
+
if (this.macMemTimer.unref) this.macMemTimer.unref();
|
|
1556
|
+
}
|
|
1557
|
+
this.collectSnapshot().then((s) => {
|
|
1558
|
+
this.cachedSnapshot = s;
|
|
1559
|
+
this.consecutiveSampleErrors = 0;
|
|
1560
|
+
}).catch((err) => this.reportSampleError(err));
|
|
1561
|
+
this.samplingTimer = setInterval(() => {
|
|
1562
|
+
this.collectSnapshot().then((s) => {
|
|
1563
|
+
this.cachedSnapshot = s;
|
|
1564
|
+
this.consecutiveSampleErrors = 0;
|
|
1565
|
+
}).catch((err) => this.reportSampleError(err));
|
|
1566
|
+
}, intervalMs);
|
|
1567
|
+
if (this.samplingTimer.unref) this.samplingTimer.unref();
|
|
1568
|
+
}
|
|
1569
|
+
reportSampleError(err) {
|
|
1570
|
+
this.consecutiveSampleErrors++;
|
|
1571
|
+
if (!this.diagnostics) return;
|
|
1572
|
+
if (!(this.consecutiveSampleErrors === 1 || this.consecutiveSampleErrors % 60 === 0)) return;
|
|
1573
|
+
this.diagnostics.warn("metrics-provider sample failed", {
|
|
1574
|
+
consecutiveErrors: this.consecutiveSampleErrors,
|
|
1575
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
stopSampling() {
|
|
1579
|
+
if (this.samplingTimer) {
|
|
1580
|
+
clearInterval(this.samplingTimer);
|
|
1581
|
+
this.samplingTimer = null;
|
|
1582
|
+
}
|
|
1583
|
+
if (this.macMemTimer) {
|
|
1584
|
+
clearInterval(this.macMemTimer);
|
|
1585
|
+
this.macMemTimer = null;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
async collectSnapshot() {
|
|
1589
|
+
const cpu = this.sampleCpu();
|
|
1590
|
+
const memory = this.getMemoryInfo();
|
|
1591
|
+
const processInfo = getProcessResources();
|
|
1592
|
+
const [gpu, network, disk, cpuTemp] = await Promise.all([
|
|
1593
|
+
getGpuInfoInternal().catch(() => null),
|
|
1594
|
+
takeNetworkIoSnapshot(),
|
|
1595
|
+
takeDiskIoSnapshot(),
|
|
1596
|
+
getCpuTemperatureInternal().catch(() => null)
|
|
1597
|
+
]);
|
|
1598
|
+
const snapshot = {
|
|
1599
|
+
cpu,
|
|
1600
|
+
memory,
|
|
1601
|
+
gpu,
|
|
1602
|
+
network,
|
|
1603
|
+
disk,
|
|
1604
|
+
pressure: {
|
|
1605
|
+
cpu: getPressure("cpu"),
|
|
1606
|
+
memory: getPressure("memory"),
|
|
1607
|
+
io: getPressure("io")
|
|
1608
|
+
},
|
|
1609
|
+
process: processInfo,
|
|
1610
|
+
cpuTemperature: cpuTemp,
|
|
1611
|
+
timestampMs: Date.now()
|
|
1612
|
+
};
|
|
1613
|
+
this.cachedSnapshot = snapshot;
|
|
1614
|
+
return snapshot;
|
|
1615
|
+
}
|
|
1616
|
+
async getCached() {
|
|
1617
|
+
return this.cachedSnapshot;
|
|
1618
|
+
}
|
|
1619
|
+
async getCurrent() {
|
|
1620
|
+
const s = this.cachedSnapshot ?? await this.collectSnapshot();
|
|
1621
|
+
const mb = (bytes) => Math.round(bytes / 1024 / 1024);
|
|
1622
|
+
return {
|
|
1623
|
+
cpuPercent: s.cpu.total,
|
|
1624
|
+
memoryPercent: s.memory.percent,
|
|
1625
|
+
memoryUsedMB: s.memory.usedBytes === null ? null : mb(s.memory.usedBytes),
|
|
1626
|
+
memoryTotalMB: mb(s.memory.totalBytes),
|
|
1627
|
+
temperature: s.cpuTemperature ?? void 0,
|
|
1628
|
+
gpuPercent: s.gpu?.utilization,
|
|
1629
|
+
gpuMemoryPercent: s.gpu && s.gpu.memoryTotalBytes > 0 ? Math.round(s.gpu.memoryUsedBytes / s.gpu.memoryTotalBytes * 1e3) / 10 : void 0
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
async getDiskSpace(input) {
|
|
1633
|
+
return getDiskSpaceInternal(input.dirPath);
|
|
1634
|
+
}
|
|
1635
|
+
async getGpuInfo() {
|
|
1636
|
+
return getGpuInfoInternal();
|
|
1637
|
+
}
|
|
1638
|
+
async getCpuTemperature() {
|
|
1639
|
+
return getCpuTemperatureInternal();
|
|
1640
|
+
}
|
|
1641
|
+
async getProcessStats(input) {
|
|
1642
|
+
const { getPidStats } = await Promise.resolve().then(() => require("../../resource-monitor-mio9dSCT.js")).then((n) => n.resource_monitor_exports);
|
|
1643
|
+
const raw = await getPidStats(input.pids);
|
|
1644
|
+
const result = [];
|
|
1645
|
+
for (const [pid, s] of raw) result.push({
|
|
1646
|
+
pid,
|
|
1647
|
+
cpu: s.cpu,
|
|
1648
|
+
memory: s.memory,
|
|
1649
|
+
privateBytes: s.privateBytes,
|
|
1650
|
+
sharedBytes: s.sharedBytes
|
|
1651
|
+
});
|
|
1652
|
+
return result;
|
|
1653
|
+
}
|
|
1654
|
+
sampleCpu() {
|
|
1655
|
+
const curr = aggregateCpuTimes();
|
|
1656
|
+
const prev = this.prevCpu;
|
|
1657
|
+
this.prevCpu = curr;
|
|
1658
|
+
const dUser = curr.user - prev.user;
|
|
1659
|
+
const dNice = curr.nice - prev.nice;
|
|
1660
|
+
const dSys = curr.sys - prev.sys;
|
|
1661
|
+
const dIrq = curr.irq - prev.irq;
|
|
1662
|
+
const dIdle = curr.idle - prev.idle;
|
|
1663
|
+
const dTotal = dUser + dNice + dSys + dIrq + dIdle;
|
|
1664
|
+
const pct = (v) => dTotal === 0 ? 0 : Math.round(v / dTotal * 1e3) / 10;
|
|
1665
|
+
return {
|
|
1666
|
+
total: pct(dUser + dNice + dSys + dIrq),
|
|
1667
|
+
user: pct(dUser),
|
|
1668
|
+
system: pct(dSys),
|
|
1669
|
+
irq: pct(dIrq),
|
|
1670
|
+
nice: pct(dNice),
|
|
1671
|
+
loadAvg: node_os.loadavg(),
|
|
1672
|
+
cores: node_os.cpus().length
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
/** Cached macOS memory (set by sampleMacMemory timer). */
|
|
1676
|
+
_cachedMacMem = null;
|
|
1677
|
+
_macMemInFlight = false;
|
|
1678
|
+
getMemoryInfo() {
|
|
1679
|
+
const total = node_os.totalmem();
|
|
1680
|
+
const unknown = {
|
|
1681
|
+
percent: null,
|
|
1682
|
+
totalBytes: total,
|
|
1683
|
+
usedBytes: null,
|
|
1684
|
+
availableBytes: null,
|
|
1685
|
+
swapUsedBytes: 0,
|
|
1686
|
+
swapTotalBytes: 0
|
|
1687
|
+
};
|
|
1688
|
+
if (total === 0) return unknown;
|
|
1689
|
+
if (IS_DARWIN) return this._cachedMacMem ?? unknown;
|
|
1690
|
+
let available = null;
|
|
1691
|
+
let swapUsedBytes = 0;
|
|
1692
|
+
let swapTotalBytes = 0;
|
|
1693
|
+
if (IS_LINUX) try {
|
|
1694
|
+
const meminfo = node_fs.readFileSync("/proc/meminfo", "utf-8");
|
|
1695
|
+
const availKb = meminfo.match(/MemAvailable:\s+(\d+)/)?.[1];
|
|
1696
|
+
if (availKb !== void 0) available = parseInt(availKb, 10) * 1024;
|
|
1697
|
+
const swapTotal = parseInt(meminfo.match(/SwapTotal:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
|
|
1698
|
+
const swapFree = parseInt(meminfo.match(/SwapFree:\s+(\d+)/)?.[1] ?? "0", 10) * 1024;
|
|
1699
|
+
swapTotalBytes = swapTotal;
|
|
1700
|
+
swapUsedBytes = swapTotal - swapFree;
|
|
1701
|
+
} catch {}
|
|
1702
|
+
else available = node_os.freemem();
|
|
1703
|
+
if (available === null) return unknown;
|
|
1704
|
+
const used = total - available;
|
|
1705
|
+
return {
|
|
1706
|
+
percent: Math.round(used / total * 1e3) / 10,
|
|
1707
|
+
totalBytes: total,
|
|
1708
|
+
usedBytes: used,
|
|
1709
|
+
availableBytes: available,
|
|
1710
|
+
swapUsedBytes,
|
|
1711
|
+
swapTotalBytes
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
};
|
|
1715
|
+
function aggregateCpuTimes() {
|
|
1716
|
+
const cpus = node_os.cpus();
|
|
1717
|
+
let user = 0, nice = 0, sys = 0, irq = 0, idle = 0;
|
|
1718
|
+
for (const cpu of cpus) {
|
|
1719
|
+
user += cpu.times.user;
|
|
1720
|
+
nice += cpu.times.nice;
|
|
1721
|
+
sys += cpu.times.sys;
|
|
1722
|
+
irq += cpu.times.irq;
|
|
1723
|
+
idle += cpu.times.idle;
|
|
1724
|
+
}
|
|
1725
|
+
return {
|
|
1726
|
+
user,
|
|
1727
|
+
nice,
|
|
1728
|
+
sys,
|
|
1729
|
+
irq,
|
|
1730
|
+
idle
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
var VM_STAT = "/usr/bin/vm_stat";
|
|
1734
|
+
var SYSCTL = "/usr/sbin/sysctl";
|
|
1735
|
+
function execFileText(file, args) {
|
|
1736
|
+
return new Promise((resolve, reject) => {
|
|
1737
|
+
(0, node_child_process.execFile)(file, [...args], {
|
|
1738
|
+
timeout: 2e3,
|
|
1739
|
+
encoding: "utf-8"
|
|
1740
|
+
}, (err, stdout) => err ? reject(err) : resolve(stdout));
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
async function readMacSwap() {
|
|
1744
|
+
try {
|
|
1745
|
+
const swapOut = await execFileText(SYSCTL, ["-n", "vm.swapusage"]);
|
|
1746
|
+
const totalMatch = swapOut.match(/total\s*=\s*([\d.]+)M/);
|
|
1747
|
+
const usedMatch = swapOut.match(/used\s*=\s*([\d.]+)M/);
|
|
1748
|
+
return {
|
|
1749
|
+
total: totalMatch ? parseFloat(totalMatch[1]) * 1024 * 1024 : 0,
|
|
1750
|
+
used: usedMatch ? parseFloat(usedMatch[1]) * 1024 * 1024 : 0
|
|
1751
|
+
};
|
|
1752
|
+
} catch {
|
|
1753
|
+
return {
|
|
1754
|
+
used: 0,
|
|
1755
|
+
total: 0
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
/** One spawn per tick (never overlapping); a failed read clears the cache. */
|
|
1760
|
+
async function sampleMacMemory(provider) {
|
|
1761
|
+
if (provider._macMemInFlight) return;
|
|
1762
|
+
provider._macMemInFlight = true;
|
|
1763
|
+
try {
|
|
1764
|
+
const pages = parseVmStat(await execFileText(VM_STAT, []));
|
|
1765
|
+
const mem = pages ? computeDarwinMemory(pages, node_os.totalmem()) : null;
|
|
1766
|
+
if (!mem) {
|
|
1767
|
+
provider._cachedMacMem = null;
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1770
|
+
const swap = await readMacSwap();
|
|
1771
|
+
provider._cachedMacMem = {
|
|
1772
|
+
percent: mem.percent,
|
|
1773
|
+
totalBytes: node_os.totalmem(),
|
|
1774
|
+
usedBytes: mem.usedBytes,
|
|
1775
|
+
availableBytes: mem.availableBytes,
|
|
1776
|
+
swapUsedBytes: swap.used,
|
|
1777
|
+
swapTotalBytes: swap.total
|
|
1778
|
+
};
|
|
1779
|
+
} catch {
|
|
1780
|
+
provider._cachedMacMem = null;
|
|
1781
|
+
} finally {
|
|
1782
|
+
provider._macMemInFlight = false;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function getDiskSpaceInternal(dirPath) {
|
|
1786
|
+
return new Promise((resolve, reject) => {
|
|
1787
|
+
node_fs.statfs(dirPath, (err, stats) => {
|
|
1788
|
+
if (err) return reject(err);
|
|
1789
|
+
const totalBytes = stats.blocks * stats.bsize;
|
|
1790
|
+
const availableBytes = stats.bavail * stats.bsize;
|
|
1791
|
+
const usedBytes = totalBytes - stats.bfree * stats.bsize;
|
|
1792
|
+
resolve({
|
|
1793
|
+
path: dirPath,
|
|
1794
|
+
totalBytes,
|
|
1795
|
+
usedBytes,
|
|
1796
|
+
availableBytes,
|
|
1797
|
+
percent: totalBytes > 0 ? Math.round(usedBytes / totalBytes * 1e3) / 10 : 0
|
|
1798
|
+
});
|
|
1799
|
+
});
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
async function takeDiskIoSnapshot() {
|
|
1803
|
+
const now = Date.now();
|
|
1804
|
+
if (IS_LINUX) try {
|
|
1805
|
+
const data = node_fs.readFileSync("/proc/diskstats", "utf-8");
|
|
1806
|
+
let readOps = 0, readBytes = 0, writeOps = 0, writeBytes = 0;
|
|
1807
|
+
for (const line of data.split("\n")) {
|
|
1808
|
+
const parts = line.trim().split(/\s+/);
|
|
1809
|
+
if (parts.length < 14) continue;
|
|
1810
|
+
const devName = parts[2];
|
|
1811
|
+
if (/\d+$/.test(devName) && !/^nvme\d+n\d+$/.test(devName)) continue;
|
|
1812
|
+
readOps += parseInt(parts[3], 10) || 0;
|
|
1813
|
+
readBytes += (parseInt(parts[5], 10) || 0) * 512;
|
|
1814
|
+
writeOps += parseInt(parts[7], 10) || 0;
|
|
1815
|
+
writeBytes += (parseInt(parts[9], 10) || 0) * 512;
|
|
1816
|
+
}
|
|
1817
|
+
return {
|
|
1818
|
+
readBytes,
|
|
1819
|
+
writeBytes,
|
|
1820
|
+
readOps,
|
|
1821
|
+
writeOps,
|
|
1822
|
+
timestampMs: now
|
|
1823
|
+
};
|
|
1824
|
+
} catch {}
|
|
1825
|
+
return {
|
|
1826
|
+
readBytes: 0,
|
|
1827
|
+
writeBytes: 0,
|
|
1828
|
+
readOps: 0,
|
|
1829
|
+
writeOps: 0,
|
|
1830
|
+
timestampMs: now
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
async function takeNetworkIoSnapshot() {
|
|
1834
|
+
const now = Date.now();
|
|
1835
|
+
if (IS_LINUX) try {
|
|
1836
|
+
const data = node_fs.readFileSync("/proc/net/dev", "utf-8");
|
|
1837
|
+
let rxBytes = 0, txBytes = 0, rxPackets = 0, txPackets = 0, rxErrors = 0, txErrors = 0;
|
|
1838
|
+
for (const line of data.split("\n")) {
|
|
1839
|
+
const match = line.match(/^\s*(\w+):\s+(.+)$/);
|
|
1840
|
+
if (!match) continue;
|
|
1841
|
+
if (match[1] === "lo") continue;
|
|
1842
|
+
const cols = match[2].trim().split(/\s+/);
|
|
1843
|
+
rxBytes += parseInt(cols[0], 10) || 0;
|
|
1844
|
+
rxPackets += parseInt(cols[1], 10) || 0;
|
|
1845
|
+
rxErrors += parseInt(cols[2], 10) || 0;
|
|
1846
|
+
txBytes += parseInt(cols[8], 10) || 0;
|
|
1847
|
+
txPackets += parseInt(cols[9], 10) || 0;
|
|
1848
|
+
txErrors += parseInt(cols[10], 10) || 0;
|
|
1849
|
+
}
|
|
1850
|
+
return {
|
|
1851
|
+
rxBytes,
|
|
1852
|
+
txBytes,
|
|
1853
|
+
rxPackets,
|
|
1854
|
+
txPackets,
|
|
1855
|
+
rxErrors,
|
|
1856
|
+
txErrors,
|
|
1857
|
+
timestampMs: now
|
|
1858
|
+
};
|
|
1859
|
+
} catch {}
|
|
1860
|
+
if (IS_DARWIN) try {
|
|
1861
|
+
const stdout = await execAsync("netstat", ["-ib"]);
|
|
1862
|
+
let rxBytes = 0, txBytes = 0, rxPackets = 0, txPackets = 0, rxErrors = 0, txErrors = 0;
|
|
1863
|
+
for (const line of stdout.split("\n")) {
|
|
1864
|
+
const parts = line.trim().split(/\s+/);
|
|
1865
|
+
if (parts.length < 11) continue;
|
|
1866
|
+
if (parts[0] === "lo0" || parts[0] === "Name") continue;
|
|
1867
|
+
if (!parts[2]?.startsWith("Link#")) continue;
|
|
1868
|
+
rxPackets += parseInt(parts[4], 10) || 0;
|
|
1869
|
+
rxErrors += parseInt(parts[5], 10) || 0;
|
|
1870
|
+
rxBytes += parseInt(parts[6], 10) || 0;
|
|
1871
|
+
txPackets += parseInt(parts[7], 10) || 0;
|
|
1872
|
+
txErrors += parseInt(parts[8], 10) || 0;
|
|
1873
|
+
txBytes += parseInt(parts[9], 10) || 0;
|
|
1874
|
+
}
|
|
1875
|
+
return {
|
|
1876
|
+
rxBytes,
|
|
1877
|
+
txBytes,
|
|
1878
|
+
rxPackets,
|
|
1879
|
+
txPackets,
|
|
1880
|
+
rxErrors,
|
|
1881
|
+
txErrors,
|
|
1882
|
+
timestampMs: now
|
|
1883
|
+
};
|
|
1884
|
+
} catch {}
|
|
1885
|
+
return {
|
|
1886
|
+
rxBytes: 0,
|
|
1887
|
+
txBytes: 0,
|
|
1888
|
+
rxPackets: 0,
|
|
1889
|
+
txPackets: 0,
|
|
1890
|
+
rxErrors: 0,
|
|
1891
|
+
txErrors: 0,
|
|
1892
|
+
timestampMs: now
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
async function getCpuTemperatureInternal() {
|
|
1896
|
+
if (IS_LINUX) for (const p of ["/sys/class/thermal/thermal_zone0/temp", "/sys/class/hwmon/hwmon0/temp1_input"]) try {
|
|
1897
|
+
const raw = node_fs.readFileSync(p, "utf-8").trim();
|
|
1898
|
+
const millideg = parseInt(raw, 10);
|
|
1899
|
+
if (!isNaN(millideg)) return Math.round(millideg / 100) / 10;
|
|
1900
|
+
} catch {
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
if (IS_DARWIN) try {
|
|
1904
|
+
const match = (await execAsync("sudo", [
|
|
1905
|
+
"-n",
|
|
1906
|
+
"powermetrics",
|
|
1907
|
+
"--samplers",
|
|
1908
|
+
"smc",
|
|
1909
|
+
"-i",
|
|
1910
|
+
"1",
|
|
1911
|
+
"-n",
|
|
1912
|
+
"1"
|
|
1913
|
+
], 3e3)).match(/CPU die temperature:\s+([\d.]+)\s*C/);
|
|
1914
|
+
if (match) return Math.round(parseFloat(match[1]) * 10) / 10;
|
|
1915
|
+
} catch {}
|
|
1916
|
+
return null;
|
|
1917
|
+
}
|
|
1918
|
+
async function getGpuInfoInternal() {
|
|
1919
|
+
if (IS_DARWIN) try {
|
|
1920
|
+
const utilMatch = (await execAsync("ioreg", [
|
|
1921
|
+
"-r",
|
|
1922
|
+
"-d",
|
|
1923
|
+
"1",
|
|
1924
|
+
"-c",
|
|
1925
|
+
"IOAccelerator"
|
|
1926
|
+
])).match(/"GPU Core Utilization"\s*=\s*(\d+)/);
|
|
1927
|
+
const util = utilMatch ? parseInt(utilMatch[1], 10) : 0;
|
|
1928
|
+
const utilPct = util > 1e3 ? Math.round(util / 1e7) : util;
|
|
1929
|
+
return {
|
|
1930
|
+
utilization: Math.min(100, utilPct),
|
|
1931
|
+
model: "Apple Silicon GPU",
|
|
1932
|
+
memoryUsedBytes: 0,
|
|
1933
|
+
memoryTotalBytes: 0,
|
|
1934
|
+
temperature: null
|
|
1935
|
+
};
|
|
1936
|
+
} catch {}
|
|
1937
|
+
if (IS_LINUX) return readNvidiaGpu({
|
|
1938
|
+
findOnPath: (binary) => findOnPath(binary, process.env["PATH"]),
|
|
1939
|
+
exec: (command, args) => execAsync(command, [...args])
|
|
1940
|
+
});
|
|
1941
|
+
return null;
|
|
1942
|
+
}
|
|
1943
|
+
function getProcessResources() {
|
|
1944
|
+
let openFds = 0;
|
|
1945
|
+
let threadCount = 0;
|
|
1946
|
+
if (IS_LINUX) {
|
|
1947
|
+
try {
|
|
1948
|
+
openFds = node_fs.readdirSync(`/proc/${process.pid}/fd`).length;
|
|
1949
|
+
} catch {}
|
|
1950
|
+
try {
|
|
1951
|
+
const match = node_fs.readFileSync(`/proc/${process.pid}/status`, "utf-8").match(/Threads:\s+(\d+)/);
|
|
1952
|
+
if (match) threadCount = parseInt(match[1], 10);
|
|
1953
|
+
} catch {}
|
|
1954
|
+
}
|
|
1955
|
+
const nodeProcess = process;
|
|
1956
|
+
return {
|
|
1957
|
+
openFds,
|
|
1958
|
+
threadCount,
|
|
1959
|
+
activeHandles: (nodeProcess._getActiveHandles?.() ?? []).length,
|
|
1960
|
+
activeRequests: (nodeProcess._getActiveRequests?.() ?? []).length
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
function getPressure(resource) {
|
|
1964
|
+
if (!IS_LINUX) return null;
|
|
1965
|
+
try {
|
|
1966
|
+
const data = node_fs.readFileSync(`/proc/pressure/${resource}`, "utf-8");
|
|
1967
|
+
const parseLine = (prefix) => {
|
|
1968
|
+
const match = data.match(new RegExp(`${prefix} avg10=(\\d+\\.\\d+) avg60=(\\d+\\.\\d+) avg300=(\\d+\\.\\d+)`));
|
|
1969
|
+
if (!match) return null;
|
|
1970
|
+
return {
|
|
1971
|
+
avg10: parseFloat(match[1]),
|
|
1972
|
+
avg60: parseFloat(match[2]),
|
|
1973
|
+
avg300: parseFloat(match[3])
|
|
1974
|
+
};
|
|
1975
|
+
};
|
|
1976
|
+
const some = parseLine("some");
|
|
1977
|
+
if (!some) return null;
|
|
1978
|
+
return {
|
|
1979
|
+
some,
|
|
1980
|
+
full: parseLine("full")
|
|
1981
|
+
};
|
|
1982
|
+
} catch {
|
|
1983
|
+
return null;
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
function execAsync(cmd, args, timeoutMs = 5e3) {
|
|
1987
|
+
return new Promise((resolve, reject) => {
|
|
1988
|
+
(0, node_child_process.execFile)(cmd, args, { timeout: timeoutMs }, (err, stdout) => {
|
|
1989
|
+
if (err) return reject(err);
|
|
1990
|
+
resolve(stdout);
|
|
1991
|
+
});
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Parse one `/proc/<pid>/stat` line. `null` for a line that does not parse —
|
|
1996
|
+
* a process that exited between the readdir and the read leaves a truncated
|
|
1997
|
+
* or empty file, and that is normal, not an error.
|
|
1998
|
+
*/
|
|
1999
|
+
function parseProcStat(line) {
|
|
2000
|
+
const close = line.lastIndexOf(")");
|
|
2001
|
+
const open = line.indexOf("(");
|
|
2002
|
+
if (close < 0 || open < 0 || close < open) return null;
|
|
2003
|
+
const pid = Number(line.slice(0, open).trim());
|
|
2004
|
+
const comm = line.slice(open + 1, close);
|
|
2005
|
+
const rest = line.slice(close + 1).trim().split(/\s+/);
|
|
2006
|
+
const state = rest[0];
|
|
2007
|
+
const ppid = Number(rest[1]);
|
|
2008
|
+
const pgid = Number(rest[2]);
|
|
2009
|
+
const utime = Number(rest[11]);
|
|
2010
|
+
const stime = Number(rest[12]);
|
|
2011
|
+
const startTicks = Number(rest[19]);
|
|
2012
|
+
const rssPages = Number(rest[21]);
|
|
2013
|
+
if (state === void 0 || state === "") return null;
|
|
2014
|
+
if (![
|
|
2015
|
+
pid,
|
|
2016
|
+
ppid,
|
|
2017
|
+
pgid,
|
|
2018
|
+
utime,
|
|
2019
|
+
stime,
|
|
2020
|
+
startTicks,
|
|
2021
|
+
rssPages
|
|
2022
|
+
].every(Number.isFinite)) return null;
|
|
2023
|
+
return {
|
|
2024
|
+
pid,
|
|
2025
|
+
comm,
|
|
2026
|
+
state,
|
|
2027
|
+
ppid,
|
|
2028
|
+
pgid,
|
|
2029
|
+
ticks: utime + stime,
|
|
2030
|
+
startTicks,
|
|
2031
|
+
rssPages
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
function statusKb(status, key) {
|
|
2035
|
+
const match = status.match(new RegExp(`^${key}:\\s+(\\d+)`, "m"));
|
|
2036
|
+
return match ? parseInt(match[1], 10) * 1024 : void 0;
|
|
2037
|
+
}
|
|
2038
|
+
/** Read `VmRSS` / `RssAnon` / `RssFile` (kB in the file) out of `/proc/<pid>/status`. */
|
|
2039
|
+
function parseProcStatusRss(status) {
|
|
2040
|
+
return {
|
|
2041
|
+
rssBytes: statusKb(status, "VmRSS"),
|
|
2042
|
+
privateBytes: statusKb(status, "RssAnon"),
|
|
2043
|
+
sharedBytes: statusKb(status, "RssFile")
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
/** Seconds the process has been alive — `ps etime`, whole seconds. */
|
|
2047
|
+
function elapsedSecSince(input) {
|
|
2048
|
+
return Math.max(0, Math.floor(input.uptimeSec - input.startTicks / 100));
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* `ps pcpu`: CPU time over elapsed time, as a percentage with one decimal.
|
|
2052
|
+
*
|
|
2053
|
+
* This is deliberately the LIFETIME average `ps` prints, not an instantaneous
|
|
2054
|
+
* rate: the columns fed from it have always shown that quantity, and the
|
|
2055
|
+
* instantaneous split is a different number with a different owner
|
|
2056
|
+
* (`cpuMainPercent` / `cpuGcPercent` from `thread-cpu-sampler.ts`). A process
|
|
2057
|
+
* with no elapsed window yet reports 0, never a division by zero.
|
|
2058
|
+
*/
|
|
2059
|
+
function lifetimeCpuPercent(input) {
|
|
2060
|
+
const elapsedSec = input.uptimeSec - input.startTicks / 100;
|
|
2061
|
+
if (!(elapsedSec > 0)) return 0;
|
|
2062
|
+
const cpuSec = input.ticks / 100;
|
|
2063
|
+
return Math.round(cpuSec / elapsedSec * 1e3) / 10;
|
|
2064
|
+
}
|
|
2065
|
+
var PID_RE = /^\d+$/;
|
|
2066
|
+
var nodeProcReader = {
|
|
2067
|
+
listPids: async () => (await (0, node_fs_promises.readdir)("/proc")).filter((entry) => PID_RE.test(entry)).map((entry) => Number(entry)),
|
|
2068
|
+
readStat: (pid) => (0, node_fs_promises.readFile)(`/proc/${pid}/stat`, "latin1"),
|
|
2069
|
+
readStatus: (pid) => (0, node_fs_promises.readFile)(`/proc/${pid}/status`, "latin1"),
|
|
2070
|
+
readCmdline: (pid) => (0, node_fs_promises.readFile)(`/proc/${pid}/cmdline`, "latin1"),
|
|
2071
|
+
readUptimeSec: async () => {
|
|
2072
|
+
const [first] = (await (0, node_fs_promises.readFile)("/proc/uptime", "latin1")).trim().split(/\s+/);
|
|
2073
|
+
const seconds = Number(first);
|
|
2074
|
+
if (!Number.isFinite(seconds)) throw new Error(`/proc/uptime unreadable: ${String(first)}`);
|
|
2075
|
+
return seconds;
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
/** `ps command=`: argv joined by spaces, or `[comm]` when there is no argv. */
|
|
2079
|
+
function commandFromCmdline(cmdline, comm) {
|
|
2080
|
+
const joined = cmdline.split("\0").filter((part) => part.length > 0).join(" ");
|
|
2081
|
+
return joined.length > 0 ? joined : `[${comm}]`;
|
|
2082
|
+
}
|
|
2083
|
+
//#endregion
|
|
2084
|
+
//#region src/builtins/native-metrics/proc-process-table.ts
|
|
2085
|
+
/**
|
|
2086
|
+
* The node's process table — every row `ps -eo pid,ppid,pgid,pcpu,rss,etime,
|
|
2087
|
+
* command` printed — read from `/proc` on Linux, with no fork.
|
|
2088
|
+
*
|
|
2089
|
+
* Why the fork mattered, and the numbers, are in `process/proc-stat.ts`. What
|
|
2090
|
+
* this file adds is the WHOLE-TABLE read: one `readdir` of `/proc`, then per
|
|
2091
|
+
* pid `stat`, `status` and `cmdline`, all through `fs/promises` so the reads
|
|
2092
|
+
* land on the libuv pool and the main thread pays only the parse. Measured in
|
|
2093
|
+
* the hub container (70 processes, D452): 2–4 ms wall for the walk, against
|
|
2094
|
+
* 3–4 ms for `ps` itself — the fork that USED to precede it was the cost.
|
|
2095
|
+
*
|
|
2096
|
+
* A pid that vanishes between the listing and its reads is omitted whole.
|
|
2097
|
+
* Never a partial row: a row with a command and no memory would render as a
|
|
2098
|
+
* process using nothing, which is a different claim from "gone".
|
|
2099
|
+
*/
|
|
2100
|
+
var execFileAsync = (0, node_util.promisify)(node_child_process.execFile);
|
|
2101
|
+
async function readProcRow(pid, uptimeSec, reader) {
|
|
2102
|
+
let stat;
|
|
2103
|
+
let cmdline;
|
|
2104
|
+
let status;
|
|
2105
|
+
try {
|
|
2106
|
+
[stat, cmdline, status] = await Promise.all([
|
|
2107
|
+
reader.readStat(pid),
|
|
2108
|
+
reader.readCmdline(pid),
|
|
2109
|
+
reader.readStatus(pid)
|
|
2110
|
+
]);
|
|
2111
|
+
} catch {
|
|
2112
|
+
return null;
|
|
2113
|
+
}
|
|
2114
|
+
const parsed = parseProcStat(stat);
|
|
2115
|
+
if (parsed === null) return null;
|
|
2116
|
+
const rss = parseProcStatusRss(status);
|
|
2117
|
+
return {
|
|
2118
|
+
pid: parsed.pid,
|
|
2119
|
+
ppid: parsed.ppid,
|
|
2120
|
+
pgid: parsed.pgid,
|
|
2121
|
+
cpuPercent: lifetimeCpuPercent({
|
|
2122
|
+
ticks: parsed.ticks,
|
|
2123
|
+
startTicks: parsed.startTicks,
|
|
2124
|
+
uptimeSec
|
|
2125
|
+
}),
|
|
2126
|
+
memoryRssBytes: rss.rssBytes ?? 0,
|
|
2127
|
+
uptimeSec: elapsedSecSince({
|
|
2128
|
+
startTicks: parsed.startTicks,
|
|
2129
|
+
uptimeSec
|
|
2130
|
+
}),
|
|
2131
|
+
command: commandFromCmdline(cmdline, parsed.comm)
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
/** Every process in `/proc`, as the rows `ps -eo …` would have printed. */
|
|
2135
|
+
async function readProcProcessTable(reader = nodeProcReader) {
|
|
2136
|
+
const [pids, uptimeSec] = await Promise.all([reader.listPids(), reader.readUptimeSec()]);
|
|
2137
|
+
return (await Promise.all(pids.map((pid) => readProcRow(pid, uptimeSec, reader)))).filter((row) => row !== null);
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* Parse `ps etime` → seconds. `MM:SS`, `HH:MM:SS`, `DD-HH:MM:SS`.
|
|
2141
|
+
* Only the `ps` path needs this; `/proc` gives the number directly.
|
|
2142
|
+
*/
|
|
2143
|
+
function parseEtime(etime) {
|
|
2144
|
+
const dashParts = etime.split("-");
|
|
2145
|
+
let days = 0;
|
|
2146
|
+
let hms = etime;
|
|
2147
|
+
if (dashParts.length === 2) {
|
|
2148
|
+
days = parseInt(dashParts[0], 10) || 0;
|
|
2149
|
+
hms = dashParts[1];
|
|
2150
|
+
}
|
|
2151
|
+
const parts = hms.split(":").map((p) => parseInt(p, 10) || 0);
|
|
2152
|
+
let hours = 0;
|
|
2153
|
+
let minutes = 0;
|
|
2154
|
+
let seconds = 0;
|
|
2155
|
+
if (parts.length === 3) [hours, minutes, seconds] = parts;
|
|
2156
|
+
else if (parts.length === 2) [minutes, seconds] = parts;
|
|
2157
|
+
else if (parts.length === 1) [seconds] = parts;
|
|
2158
|
+
return days * 86400 + hours * 3600 + minutes * 60 + seconds;
|
|
2159
|
+
}
|
|
2160
|
+
var PS_ROW_RE = /^(\d+)\s+(\d+)\s+(\d+)\s+([\d.]+)\s+(\d+)\s+(\S+)\s+(.+)$/;
|
|
2161
|
+
/** Parse the output of `ps -eo pid=,ppid=,pgid=,pcpu=,rss=,etime=,command=`. */
|
|
2162
|
+
function parsePsTable(stdout) {
|
|
2163
|
+
const rows = [];
|
|
2164
|
+
for (const line of stdout.split("\n")) {
|
|
2165
|
+
const match = line.trim().match(PS_ROW_RE);
|
|
2166
|
+
if (!match) continue;
|
|
2167
|
+
const [, pidS, ppidS, pgidS, cpuS, rssS, etimeS, command] = match;
|
|
2168
|
+
rows.push({
|
|
2169
|
+
pid: parseInt(pidS, 10),
|
|
2170
|
+
ppid: parseInt(ppidS, 10),
|
|
2171
|
+
pgid: parseInt(pgidS, 10),
|
|
2172
|
+
cpuPercent: Math.round(parseFloat(cpuS) * 10) / 10,
|
|
2173
|
+
memoryRssBytes: parseInt(rssS, 10) * 1024,
|
|
2174
|
+
uptimeSec: parseEtime(etimeS),
|
|
2175
|
+
command
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2178
|
+
return rows;
|
|
2179
|
+
}
|
|
2180
|
+
/** The fork. Only reached on a platform without `/proc`. */
|
|
2181
|
+
async function spawnPsTable() {
|
|
2182
|
+
const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid=,pgid=,pcpu=,rss=,etime=,command="], {
|
|
2183
|
+
timeout: 5e3,
|
|
2184
|
+
maxBuffer: 8 * 1024 * 1024
|
|
2185
|
+
});
|
|
2186
|
+
return parsePsTable(stdout);
|
|
2187
|
+
}
|
|
2188
|
+
var defaultDeps = {
|
|
2189
|
+
platform: (0, node_os.platform)(),
|
|
2190
|
+
reader: nodeProcReader,
|
|
2191
|
+
spawnPs: spawnPsTable
|
|
2192
|
+
};
|
|
2193
|
+
/**
|
|
2194
|
+
* The process table, from `/proc` where it exists and from `ps` elsewhere.
|
|
2195
|
+
* Throws only when the chosen source cannot answer at all; the caller logs it
|
|
2196
|
+
* as a skipped interval.
|
|
2197
|
+
*/
|
|
2198
|
+
function readProcessTable(deps = defaultDeps) {
|
|
2199
|
+
return deps.platform === "linux" ? readProcProcessTable(deps.reader) : deps.spawnPs();
|
|
2200
|
+
}
|
|
2201
|
+
//#endregion
|
|
2202
|
+
//#region src/builtins/native-metrics/process-classification.ts
|
|
2203
|
+
/**
|
|
2204
|
+
* Regex matching camstack-related command lines. We surface anything with
|
|
2205
|
+
* an obvious camstack fingerprint so operators can spot stray inference
|
|
2206
|
+
* pools, leaked tsx watchers, and zombie node workers in the Cluster →
|
|
2207
|
+
* Agent → Processes tab.
|
|
2208
|
+
*
|
|
2209
|
+
* Patterns mirror `scripts/hunt-zombies.sh` — keep them in sync when
|
|
2210
|
+
* adding a new long-lived subprocess.
|
|
2211
|
+
*/
|
|
2212
|
+
var CAMSTACK_CMD_RE = /(camstack|tsx\s+watch\s.*launcher\.ts|packages\/agent\/dist\/cli\.js|inference_pool\.py|bench-(inference-pool|nodeav)|node .*\/packages\/)/;
|
|
2213
|
+
/**
|
|
2214
|
+
* Classify one pid.
|
|
2215
|
+
*
|
|
2216
|
+
* Identity-driven, not ancestry-driven: a process is `root` because it IS
|
|
2217
|
+
* this node, `managed` because the kernel named it, and `system` otherwise.
|
|
2218
|
+
* There is no third source of truth to consult and no walk to get wrong.
|
|
2219
|
+
*/
|
|
2220
|
+
function classifyProcess(pid, selfPid, managed) {
|
|
2221
|
+
if (pid === selfPid) return "root";
|
|
2222
|
+
if (managed.has(pid)) return "managed";
|
|
2223
|
+
return "system";
|
|
2224
|
+
}
|
|
2225
|
+
/** Turn a `ps` snapshot into the node's process table. */
|
|
2226
|
+
function buildNodeProcesses(input) {
|
|
2227
|
+
const out = [];
|
|
2228
|
+
for (const p of input.psRows) {
|
|
2229
|
+
if (!CAMSTACK_CMD_RE.test(p.command)) continue;
|
|
2230
|
+
const managed = input.managed.get(p.pid);
|
|
2231
|
+
const split = input.cpuSplits.get(p.pid);
|
|
2232
|
+
const classification = classifyProcess(p.pid, input.selfPid, input.managed);
|
|
2233
|
+
out.push({
|
|
2234
|
+
pid: p.pid,
|
|
2235
|
+
ppid: p.ppid,
|
|
2236
|
+
pgid: p.pgid,
|
|
2237
|
+
classification,
|
|
2238
|
+
addonId: managed?.addonId ?? null,
|
|
2239
|
+
nodeId: managed?.nodeId ?? (p.pid === input.selfPid ? input.selfNodeId : null),
|
|
2240
|
+
command: p.command,
|
|
2241
|
+
cpuPercent: p.cpuPercent,
|
|
2242
|
+
memoryRssBytes: p.memoryRssBytes,
|
|
2243
|
+
cpuMainPercent: split?.mainPercent ?? null,
|
|
2244
|
+
cpuGcPercent: split?.gcPercent ?? null,
|
|
2245
|
+
threadCount: split?.threadCount ?? null,
|
|
2246
|
+
uptimeSec: p.uptimeSec
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2249
|
+
return out;
|
|
2250
|
+
}
|
|
2251
|
+
//#endregion
|
|
2252
|
+
//#region src/builtins/native-metrics/thread-cpu-sampler.ts
|
|
2253
|
+
/**
|
|
2254
|
+
* Per-process CPU split: the process's OWN threads vs V8's helper-thread pool.
|
|
2255
|
+
*
|
|
2256
|
+
* ## Why this exists
|
|
2257
|
+
*
|
|
2258
|
+
* `ps pcpu` — the number every CPU column in this app renders today — is the
|
|
2259
|
+
* process's CPU averaged over its **entire lifetime**. On a runner that has
|
|
2260
|
+
* been up for three days it barely moves, which makes it useless as a series:
|
|
2261
|
+
* a chart drawn from it is a flat line that cannot show a spike.
|
|
2262
|
+
*
|
|
2263
|
+
* Worse, a single total hides the finding that rewrote the 2026-08-27
|
|
2264
|
+
* diagnosis. Separating the V8 helper threads from the rest showed that ~2
|
|
2265
|
+
* whole cores of the container **were not computing** — hub-main was at 73%
|
|
2266
|
+
* and `stream-broker` at 61% of their CPU in that pool
|
|
2267
|
+
* (`docs/architecture/load-ledger.md`). A CPU chart that does not split the
|
|
2268
|
+
* two renders "busy" where the truth is "allocating too much".
|
|
2269
|
+
*
|
|
2270
|
+
* This module produces both at once, from the source the ledger prescribes:
|
|
2271
|
+
* a delta over `/proc/<pid>/task/<tid>/stat`, classified by thread name.
|
|
2272
|
+
*
|
|
2273
|
+
* ## What `gcPercent` actually contains — read this before quoting it
|
|
2274
|
+
*
|
|
2275
|
+
* It is the CPU of the threads V8 names `V8Worker`: its platform worker pool.
|
|
2276
|
+
* Concurrent marking and sweeping run there, and so does background
|
|
2277
|
+
* compilation. So `gcPercent` is **"the V8 helper pool"**, of which GC is the
|
|
2278
|
+
* dominant but not the only tenant. It is exactly the quantity the load ledger
|
|
2279
|
+
* measured — the 73% / 61% figures are this number — and it is reported under
|
|
2280
|
+
* that name for continuity, not because every jiffy in it is a collection.
|
|
2281
|
+
* The UI labels it `GC / V8 helpers` for the same reason.
|
|
2282
|
+
*
|
|
2283
|
+
* ## Cost
|
|
2284
|
+
*
|
|
2285
|
+
* One `readdir` plus one small `read` per thread, for the camstack-shaped pids
|
|
2286
|
+
* ONLY — on a busy node that is ~10 processes × ~10-40 threads. It rides the
|
|
2287
|
+
* existing 20 s process-snapshot tick and never adds a timer of its own, so it
|
|
2288
|
+
* is strictly cheaper than the full-process-table `ps -eo` scan that tick
|
|
2289
|
+
* already pays. There is no high-frequency sampler here; that is the defect
|
|
2290
|
+
* the load ledger documents.
|
|
2291
|
+
*
|
|
2292
|
+
* ## Linux only
|
|
2293
|
+
*
|
|
2294
|
+
* `/proc/<pid>/task` does not exist on macOS or Windows. Every read returns
|
|
2295
|
+
* `null` there, and `null` must reach the UI as "unknown" — never as zero.
|
|
2296
|
+
*/
|
|
2297
|
+
/**
|
|
2298
|
+
* Kernel jiffies per second (`USER_HZ`). `sysconf(_SC_CLK_TCK)` is not exposed
|
|
2299
|
+
* to Node, and this has been 100 on every Linux/x86-64 and arm64 kernel
|
|
2300
|
+
* configuration we ship to. It scales both numerator and denominator of the
|
|
2301
|
+
* ratio identically, so a wrong value would scale all CPU numbers by a
|
|
2302
|
+
* constant — visible immediately, not a silent skew.
|
|
2303
|
+
*/
|
|
2304
|
+
var CLOCK_TICKS_PER_SEC = 100;
|
|
2305
|
+
/**
|
|
2306
|
+
* Thread names V8 gives its platform worker pool. `comm` is capped at 15
|
|
2307
|
+
* characters by the kernel, which is why this matches a PREFIX.
|
|
2308
|
+
*/
|
|
2309
|
+
var V8_HELPER_THREAD_RE = /^V8Worker/;
|
|
2310
|
+
function parseThreadStat(line) {
|
|
2311
|
+
const close = line.lastIndexOf(")");
|
|
2312
|
+
const open = line.indexOf("(");
|
|
2313
|
+
if (close < 0 || open < 0 || close < open) return null;
|
|
2314
|
+
const comm = line.slice(open + 1, close);
|
|
2315
|
+
const rest = line.slice(close + 1).trim().split(/\s+/);
|
|
2316
|
+
const utime = Number(rest[11]);
|
|
2317
|
+
const stime = Number(rest[12]);
|
|
2318
|
+
const startTicks = Number(rest[19]);
|
|
2319
|
+
if (!Number.isFinite(utime) || !Number.isFinite(stime)) return null;
|
|
2320
|
+
if (!Number.isFinite(startTicks)) return null;
|
|
2321
|
+
return {
|
|
2322
|
+
comm,
|
|
2323
|
+
ticks: utime + stime,
|
|
2324
|
+
startTicks
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
var nodeProcFsReader = {
|
|
2328
|
+
listTaskIds: (pid) => (0, node_fs_promises.readdir)(`/proc/${pid}/task`),
|
|
2329
|
+
readTaskStat: (pid, tid) => (0, node_fs_promises.readFile)(`/proc/${pid}/task/${tid}/stat`, "utf8")
|
|
2330
|
+
};
|
|
2331
|
+
/**
|
|
2332
|
+
* Read one instant's tick counts for `pid`, or `null` when the process has no
|
|
2333
|
+
* readable `/proc/<pid>/task` — it exited, we lack permission, or this is not
|
|
2334
|
+
* Linux. `null` is "unknown"; it must never be turned into a zero downstream.
|
|
2335
|
+
*/
|
|
2336
|
+
async function readThreadTicks(pid, reader = nodeProcFsReader) {
|
|
2337
|
+
let tids;
|
|
2338
|
+
try {
|
|
2339
|
+
tids = await reader.listTaskIds(pid);
|
|
2340
|
+
} catch {
|
|
2341
|
+
return null;
|
|
2342
|
+
}
|
|
2343
|
+
let mainTicks = 0;
|
|
2344
|
+
let gcTicks = 0;
|
|
2345
|
+
let threadCount = 0;
|
|
2346
|
+
let startTicks = null;
|
|
2347
|
+
const mainThreadTid = String(pid);
|
|
2348
|
+
for (const tid of tids) {
|
|
2349
|
+
let line;
|
|
2350
|
+
try {
|
|
2351
|
+
line = await reader.readTaskStat(pid, tid);
|
|
2352
|
+
} catch {
|
|
2353
|
+
continue;
|
|
2354
|
+
}
|
|
2355
|
+
const parsed = parseThreadStat(line);
|
|
2356
|
+
if (parsed === null) continue;
|
|
2357
|
+
threadCount += 1;
|
|
2358
|
+
if (tid === mainThreadTid) startTicks = parsed.startTicks;
|
|
2359
|
+
if (V8_HELPER_THREAD_RE.test(parsed.comm)) gcTicks += parsed.ticks;
|
|
2360
|
+
else mainTicks += parsed.ticks;
|
|
2361
|
+
}
|
|
2362
|
+
if (threadCount === 0) return null;
|
|
2363
|
+
return {
|
|
2364
|
+
mainTicks,
|
|
2365
|
+
gcTicks,
|
|
2366
|
+
threadCount,
|
|
2367
|
+
atMs: Date.now(),
|
|
2368
|
+
startTicks
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* The CPU split between two samples of the SAME process.
|
|
2373
|
+
*
|
|
2374
|
+
* Returns `null` — never a zero — when the window cannot produce a rate:
|
|
2375
|
+
* - the two samples are not separated in time (no window to divide by);
|
|
2376
|
+
* - the pid's `starttime` changed, or is unknown on either side. A changed
|
|
2377
|
+
* starttime means the pid was RECYCLED: this is a different process that
|
|
2378
|
+
* happens to wear the same number. See below for why the tick check alone
|
|
2379
|
+
* does not catch it;
|
|
2380
|
+
* - either tick count went BACKWARDS, which is the same fault seen from the
|
|
2381
|
+
* other side. A negative delta divided by a window would render as a
|
|
2382
|
+
* plausible small number for the wrong process, and a plausible wrong
|
|
2383
|
+
* number is the failure this whole surface exists to avoid.
|
|
2384
|
+
*
|
|
2385
|
+
* ## Why `starttime` and not just the backwards-tick check
|
|
2386
|
+
*
|
|
2387
|
+
* The backwards check only fires when the NEW process has burned FEWER ticks
|
|
2388
|
+
* than the dead one had. A recycled pid landing on a busier process — an
|
|
2389
|
+
* ffmpeg that has been transcoding for a minute inheriting the pid of an
|
|
2390
|
+
* ffmpeg that idled — produces a large POSITIVE delta, which divides cleanly
|
|
2391
|
+
* and renders as a spike. That is not a hypothetical rounding concern now that
|
|
2392
|
+
* the process snapshot attributes each pid to a camera: it would charge one
|
|
2393
|
+
* camera for another camera's whole lifetime of CPU, in a chart built
|
|
2394
|
+
* specifically to answer "why is 102 worse than 101". `starttime` is the pid's
|
|
2395
|
+
* incarnation number and it catches both directions.
|
|
2396
|
+
*/
|
|
2397
|
+
function cpuSplitBetween(prev, next) {
|
|
2398
|
+
const windowMs = next.atMs - prev.atMs;
|
|
2399
|
+
if (windowMs <= 0) return null;
|
|
2400
|
+
if (prev.startTicks === null || next.startTicks === null) return null;
|
|
2401
|
+
if (prev.startTicks !== next.startTicks) return null;
|
|
2402
|
+
const mainDelta = next.mainTicks - prev.mainTicks;
|
|
2403
|
+
const gcDelta = next.gcTicks - prev.gcTicks;
|
|
2404
|
+
if (mainDelta < 0 || gcDelta < 0) return null;
|
|
2405
|
+
const windowTicks = windowMs / 1e3 * CLOCK_TICKS_PER_SEC;
|
|
2406
|
+
const pct = (delta) => Math.round(delta / windowTicks * 1e3) / 10;
|
|
2407
|
+
return {
|
|
2408
|
+
mainPercent: pct(mainDelta),
|
|
2409
|
+
gcPercent: pct(gcDelta),
|
|
2410
|
+
threadCount: next.threadCount
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Keeps the previous tick sample per pid so the next process-snapshot tick can
|
|
2415
|
+
* turn it into a rate.
|
|
2416
|
+
*
|
|
2417
|
+
* Bounded by construction: {@link sample} replaces the whole map with only the
|
|
2418
|
+
* pids it was just asked about, so a pid that stops appearing in the scan is
|
|
2419
|
+
* dropped on the following tick rather than accumulating forever.
|
|
2420
|
+
*/
|
|
2421
|
+
var ThreadCpuTracker = class {
|
|
2422
|
+
reader;
|
|
2423
|
+
previous = /* @__PURE__ */ new Map();
|
|
2424
|
+
constructor(reader = nodeProcFsReader) {
|
|
2425
|
+
this.reader = reader;
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Sample `pids` and return the split for each one that HAS a usable previous
|
|
2429
|
+
* sample. A pid absent from the result has no answer yet — the caller must
|
|
2430
|
+
* report `null`, not `0`.
|
|
2431
|
+
*/
|
|
2432
|
+
async sample(pids) {
|
|
2433
|
+
const out = /* @__PURE__ */ new Map();
|
|
2434
|
+
const nextPrevious = /* @__PURE__ */ new Map();
|
|
2435
|
+
for (const pid of pids) {
|
|
2436
|
+
const next = await readThreadTicks(pid, this.reader);
|
|
2437
|
+
if (next === null) continue;
|
|
2438
|
+
nextPrevious.set(pid, next);
|
|
2439
|
+
const prev = this.previous.get(pid);
|
|
2440
|
+
if (prev === void 0) continue;
|
|
2441
|
+
const split = cpuSplitBetween(prev, next);
|
|
2442
|
+
if (split !== null) out.set(pid, split);
|
|
2443
|
+
}
|
|
2444
|
+
this.previous = nextPrevious;
|
|
2445
|
+
return out;
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
//#endregion
|
|
2449
|
+
//#region src/builtins/native-metrics/native-metrics.addon.ts
|
|
2450
|
+
/** The hub's node id — `isHub` below is the same test; device-history lives there. */
|
|
2451
|
+
var HUB_NODE_ID = "hub";
|
|
2452
|
+
/**
|
|
2453
|
+
* Cadence for the per-node metric snapshot bus events. ~5 s matches
|
|
2454
|
+
* the existing UI polling cadence (ProcessesTab, ProcessResources)
|
|
2455
|
+
* and stays within the sampling interval so consumers always see a
|
|
2456
|
+
* fresh-from-OS payload.
|
|
2457
|
+
*/
|
|
2458
|
+
var METRICS_SNAPSHOT_INTERVAL_MS = 5e3;
|
|
2459
|
+
/**
|
|
2460
|
+
* Force a RESOURCES-snapshot emit at least every 60s even when the
|
|
2461
|
+
* coarsened payload looks unchanged. Without this an idle node
|
|
2462
|
+
* (steady CPU within ±5%, no process churn) goes silent on the
|
|
2463
|
+
* bus and the UI's "node alive" chip can stale out.
|
|
2464
|
+
*
|
|
2465
|
+
* The PROCESS-tree snapshot has no such heartbeat and no dedup: it is
|
|
2466
|
+
* fixed-cadence — see `startProcessSnapshotTimer`.
|
|
2467
|
+
*/
|
|
2468
|
+
var METRICS_SNAPSHOT_HEARTBEAT_MS = 6e4;
|
|
2469
|
+
/**
|
|
2470
|
+
* Coarsen CPU/mem percentages to integer buckets before deduping.
|
|
2471
|
+
* Without this every 5s tick differs by ±0.3% and the equality check
|
|
2472
|
+
* always fails, so the snapshot fans out unconditionally.
|
|
2473
|
+
*/
|
|
2474
|
+
function coarsenResourcesSnapshot(snapshot) {
|
|
2475
|
+
if (!snapshot || typeof snapshot !== "object") return JSON.stringify(snapshot);
|
|
2476
|
+
const round = (v) => {
|
|
2477
|
+
if (typeof v === "number") {
|
|
2478
|
+
if (v >= 0 && v <= 100) return Math.round(v / 5) * 5;
|
|
2479
|
+
return Math.round(v / 1e5) * 1e5;
|
|
2480
|
+
}
|
|
2481
|
+
if (Array.isArray(v)) return v.map(round);
|
|
2482
|
+
if (v && typeof v === "object") {
|
|
2483
|
+
const out = {};
|
|
2484
|
+
for (const [k, val] of Object.entries(v)) out[k] = round(val);
|
|
2485
|
+
return out;
|
|
2486
|
+
}
|
|
2487
|
+
return v;
|
|
2488
|
+
};
|
|
2489
|
+
return JSON.stringify(round(snapshot));
|
|
2490
|
+
}
|
|
2491
|
+
function narrowWorkerState(state) {
|
|
2492
|
+
switch (state) {
|
|
2493
|
+
case "starting":
|
|
2494
|
+
case "running":
|
|
2495
|
+
case "stopping":
|
|
2496
|
+
case "stopped":
|
|
2497
|
+
case "crashed": return state;
|
|
2498
|
+
default: return "running";
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Native metrics — CPU, memory, disk usage sampling.
|
|
2503
|
+
* Settings appear under Cluster → NodeDetail → Settings.
|
|
2504
|
+
*/
|
|
2505
|
+
var NativeMetricsAddon = class NativeMetricsAddon extends require_dist.BaseAddon {
|
|
2506
|
+
provider = null;
|
|
2507
|
+
startedAtMs = Date.now();
|
|
2508
|
+
snapshotTimer = null;
|
|
2509
|
+
processSnapshotTimer = null;
|
|
2510
|
+
/**
|
|
2511
|
+
* Snapshot-equality cache for the resources + processes emit.
|
|
2512
|
+
* Stores the coarsened JSON and timestamp; a tick where the
|
|
2513
|
+
* coarsened payload matches the cache (and the heartbeat hasn't
|
|
2514
|
+
* elapsed) is skipped.
|
|
2515
|
+
*/
|
|
2516
|
+
lastResourcesEmit = null;
|
|
2517
|
+
/**
|
|
2518
|
+
* Holds the previous `/proc/<pid>/task/*` tick counts so each process scan
|
|
2519
|
+
* can turn them into an instantaneous CPU rate split between the process's
|
|
2520
|
+
* own threads and V8's helper pool. Self-bounding — see `ThreadCpuTracker`.
|
|
2521
|
+
*/
|
|
2522
|
+
threadCpu = new ThreadCpuTracker();
|
|
2523
|
+
/**
|
|
2524
|
+
* Retention for the snapshots this addon emits. Fed by SUBSCRIBING to
|
|
2525
|
+
* `metrics.node-processes-snapshot`, never by a second sampler — on the hub
|
|
2526
|
+
* that bus carries every node, so the hub's ring is the cluster's. Bounds and
|
|
2527
|
+
* measured cost live in `node-load-ring.ts`.
|
|
2528
|
+
*/
|
|
2529
|
+
loadRing = new NodeLoadRing();
|
|
2530
|
+
/**
|
|
2531
|
+
* The COLD tier, and it exists only on the HUB.
|
|
2532
|
+
*
|
|
2533
|
+
* The table is hub-resident and the hub already hears every node's snapshot
|
|
2534
|
+
* on its bus, so the hub's writer is the cluster's. An agent writing through
|
|
2535
|
+
* the `settings-store` singleton would ship its rows over Moleculer, once
|
|
2536
|
+
* per sample, to reach that very same table.
|
|
2537
|
+
*/
|
|
2538
|
+
metricsHistory = null;
|
|
2539
|
+
/**
|
|
2540
|
+
* The container's OWN memory, sampled on the process-snapshot tick.
|
|
2541
|
+
*
|
|
2542
|
+
* It rides that tick rather than a timer of its own so a memory reading and
|
|
2543
|
+
* the process rows it must be compared against carry the SAME timestamp —
|
|
2544
|
+
* the whole question is a subtraction, and two clocks make it an estimate.
|
|
2545
|
+
* Constructed in `onInitialize`, where the logger exists; it resolves the
|
|
2546
|
+
* cgroup once and latches.
|
|
2547
|
+
*/
|
|
2548
|
+
memoryProbe = null;
|
|
2549
|
+
pidsProbe = null;
|
|
2550
|
+
/** Hot tier for the container reading. Bounds in `container-memory-ring.ts`. */
|
|
2551
|
+
memoryRing = new ContainerMemoryRing();
|
|
2552
|
+
/** The resolved knobs. Re-resolved on every settings write. */
|
|
2553
|
+
loadConfig = {
|
|
2554
|
+
cadenceSec: 10,
|
|
2555
|
+
retentionHours: 6,
|
|
2556
|
+
maxRows: DEFAULT_MAX_ROWS
|
|
2557
|
+
};
|
|
2558
|
+
/**
|
|
2559
|
+
* Process rows seen in each node's most recent snapshot — the OBSERVED
|
|
2560
|
+
* numbers the settings form projects its cost from. A constant here would be
|
|
2561
|
+
* a projection that stops being true the first time the fleet changes.
|
|
2562
|
+
*/
|
|
2563
|
+
observedRowsByNode = /* @__PURE__ */ new Map();
|
|
2564
|
+
constructor() {
|
|
2565
|
+
super({
|
|
2566
|
+
samplingIntervalMs: 5e3,
|
|
2567
|
+
loadSeriesCadenceSec: 10,
|
|
2568
|
+
loadSeriesRetentionHours: 6
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
/** Is this the hub? The same test every other addon uses (`addon-ai`). */
|
|
2572
|
+
get isHub() {
|
|
2573
|
+
return (this.ctx.kernel.cluster?.broker?.nodeID ?? HUB_NODE_ID) === HUB_NODE_ID;
|
|
2574
|
+
}
|
|
2575
|
+
/** Process rows observed across the whole fleet, for the cost projection. */
|
|
2576
|
+
observedFleetRows() {
|
|
2577
|
+
let total = 0;
|
|
2578
|
+
for (const rows of this.observedRowsByNode.values()) total += rows;
|
|
2579
|
+
return total;
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Project a `NodeProcess` onto the series' own row.
|
|
2583
|
+
*
|
|
2584
|
+
* `command`, `ppid`, `pgid`, `nodeId`, `threadCount` and `uptimeSec` are
|
|
2585
|
+
* dropped here, at the single point both tiers pass through, so the hot ring
|
|
2586
|
+
* and the cold table carry the SAME shape and the merged read cannot tell
|
|
2587
|
+
* them apart. `command` in particular is the fattest field in a snapshot and
|
|
2588
|
+
* the same identical string on every runner — the runner id travels in the
|
|
2589
|
+
* environment, not in argv — and nothing that draws this series reads it.
|
|
2590
|
+
*/
|
|
2591
|
+
static toRetained(process) {
|
|
2592
|
+
return {
|
|
2593
|
+
pid: process.pid,
|
|
2594
|
+
addonId: process.addonId,
|
|
2595
|
+
classification: process.classification,
|
|
2596
|
+
cpuPercent: process.cpuPercent,
|
|
2597
|
+
memoryRssBytes: process.memoryRssBytes,
|
|
2598
|
+
cpuMainPercent: process.cpuMainPercent,
|
|
2599
|
+
cpuGcPercent: process.cpuGcPercent
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
async onInitialize() {
|
|
2603
|
+
const provider = new NativeMetricsProvider();
|
|
2604
|
+
provider.setDiagnostics({ warn: (message, meta) => this.ctx.logger.warn(message, { meta: meta ?? {} }) });
|
|
2605
|
+
provider.startSampling(this.config.samplingIntervalMs);
|
|
2606
|
+
this.provider = provider;
|
|
2607
|
+
this.startedAtMs = Date.now();
|
|
2608
|
+
this.ctx.logger.info("Native metrics provider started", { meta: { intervalMs: this.config.samplingIntervalMs } });
|
|
2609
|
+
const composed = {
|
|
2610
|
+
collectSnapshot: () => provider.collectSnapshot(),
|
|
2611
|
+
getCached: () => provider.getCached(),
|
|
2612
|
+
getCurrent: () => provider.getCurrent(),
|
|
2613
|
+
getDiskSpace: (params) => provider.getDiskSpace(params),
|
|
2614
|
+
getGpuInfo: () => provider.getGpuInfo(),
|
|
2615
|
+
getCpuTemperature: () => provider.getCpuTemperature(),
|
|
2616
|
+
getProcessStats: (params) => provider.getProcessStats(params),
|
|
2617
|
+
listAddonInstances: () => this.listAddonInstances(),
|
|
2618
|
+
getAddonStats: (params) => this.getAddonStats(params.addonId),
|
|
2619
|
+
listNodeProcesses: () => this.listNodeProcesses(),
|
|
2620
|
+
getLoadSeries: (params) => this.readLoadSeries(params)
|
|
2621
|
+
};
|
|
2622
|
+
this.applyLoadSeriesConfig();
|
|
2623
|
+
if (this.isHub) {
|
|
2624
|
+
const historyScope = {
|
|
2625
|
+
type: "node",
|
|
2626
|
+
nodeId: HUB_NODE_ID
|
|
2627
|
+
};
|
|
2628
|
+
const historyHandle = this.ctx.useCapability("device-history", historyScope);
|
|
2629
|
+
const recorder = new NodeMetricsHistoryRecorder({
|
|
2630
|
+
deviceHistory: nodeMetricsHistoryClient(this.ctx.api.deviceHistory),
|
|
2631
|
+
logger: this.ctx.logger.child("NodeMetricsHistory"),
|
|
2632
|
+
historyReady: () => historyHandle.isReady
|
|
2633
|
+
});
|
|
2634
|
+
this.metricsHistory = recorder;
|
|
2635
|
+
const declareNow = () => {
|
|
2636
|
+
recorder.declare().catch((err) => {
|
|
2637
|
+
this.ctx.logger.warn("node metrics history declare failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
2638
|
+
});
|
|
2639
|
+
};
|
|
2640
|
+
this.ctx.addDisposer(this.ctx.onCapabilityStateChange("device-history", historyScope, (state) => {
|
|
2641
|
+
if (state === "ready") declareNow();
|
|
2642
|
+
}));
|
|
2643
|
+
if (historyHandle.isReady) declareNow();
|
|
2644
|
+
}
|
|
2645
|
+
this.memoryProbe = new ContainerMemoryProbe({ logger: this.ctx.logger.child("ContainerMemory") });
|
|
2646
|
+
this.pidsProbe = new ContainerPidsProbe({ logger: this.ctx.logger.child("ContainerPids") });
|
|
2647
|
+
if (this.snapshotTimer) clearInterval(this.snapshotTimer);
|
|
2648
|
+
this.snapshotTimer = setInterval(() => this.runTick("resources snapshot", () => this.emitResourcesSnapshot()), METRICS_SNAPSHOT_INTERVAL_MS);
|
|
2649
|
+
this.startProcessSnapshotTimer();
|
|
2650
|
+
if (this.metricsHistory !== null) {
|
|
2651
|
+
const history = this.metricsHistory;
|
|
2652
|
+
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category: require_dist.EventCategory.MetricsNodeResourcesSnapshot }, (event) => {
|
|
2653
|
+
history.recordTotals(event.data.nodeId, event.data.timestamp, event.data.snapshot);
|
|
2654
|
+
}));
|
|
2655
|
+
}
|
|
2656
|
+
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category: require_dist.EventCategory.MetricsNodeProcessesSnapshot }, (event) => this.retainSnapshot(event.data.nodeId, event.data.timestamp, event.data.processes, event.data.containerMemory)));
|
|
2657
|
+
return [{
|
|
2658
|
+
capability: require_dist.metricsProviderCapability,
|
|
2659
|
+
provider: composed
|
|
2660
|
+
}];
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Retain one arriving snapshot in BOTH tiers.
|
|
2664
|
+
*
|
|
2665
|
+
* The ring is written FIRST and it is the gate: `record` refuses a timestamp
|
|
2666
|
+
* this node has already delivered, and only an accepted sample reaches the
|
|
2667
|
+
* table. That is what makes the append idempotent without a unique index
|
|
2668
|
+
* over two million rows — the composite key it replaces was measured at ~40
|
|
2669
|
+
* bytes per row (measured on the old SQLite tier; see D850).
|
|
2670
|
+
*
|
|
2671
|
+
* The durable append is fire-and-forget: a storage stall must cost a gap in
|
|
2672
|
+
* the cold window, never a blocked event-bus handler. Every failure logs.
|
|
2673
|
+
*/
|
|
2674
|
+
retainSnapshot(nodeId, atMs, processes, containerMemory) {
|
|
2675
|
+
const retained = processes.map((p) => NativeMetricsAddon.toRetained(p));
|
|
2676
|
+
if (!this.loadRing.record(nodeId, atMs, retained)) return;
|
|
2677
|
+
this.observedRowsByNode.set(nodeId, retained.length);
|
|
2678
|
+
if (containerMemory !== null) this.memoryRing.record(nodeId, atMs, containerMemory);
|
|
2679
|
+
const history = this.metricsHistory;
|
|
2680
|
+
if (history === null) return;
|
|
2681
|
+
history.recordSample(nodeId, atMs, retained, containerMemory);
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* The ONE reader, over both tiers.
|
|
2685
|
+
*
|
|
2686
|
+
* Cold first, hot second, merged and deduped on `atMs` — see
|
|
2687
|
+
* `load-series-reader.ts`. The cold read is bounded in ROWS, because rows
|
|
2688
|
+
* are what a query costs, and the fold + reduction happen HERE rather than
|
|
2689
|
+
* in the browser: six hours at the 10 s cadence is 2 160 snapshots, and
|
|
2690
|
+
* shipping them to a page that will discard most of them is precisely the
|
|
2691
|
+
* cost this subsystem exists to avoid.
|
|
2692
|
+
*/
|
|
2693
|
+
async readLoadSeries(params) {
|
|
2694
|
+
const cadenceMs = this.loadConfig.cadenceSec * 1e3;
|
|
2695
|
+
const sinceMs = params.sinceMs ?? 0;
|
|
2696
|
+
const hotSamples = this.loadRing.read(params.forNodeId, params.sinceMs).samples.map((sample) => ({
|
|
2697
|
+
atMs: sample.atMs,
|
|
2698
|
+
processes: sample.processes
|
|
2699
|
+
}));
|
|
2700
|
+
const history = this.metricsHistory;
|
|
2701
|
+
const merged = mergeLoadSeries({
|
|
2702
|
+
cold: history === null ? [] : await history.readProcessSamples(params.forNodeId, sinceMs, this.loadConfig.maxRows),
|
|
2703
|
+
hot: hotSamples,
|
|
2704
|
+
cadenceMs,
|
|
2705
|
+
...params.maxPoints !== void 0 ? { maxPoints: params.maxPoints } : {}
|
|
2706
|
+
});
|
|
2707
|
+
return {
|
|
2708
|
+
nodeId: params.forNodeId,
|
|
2709
|
+
series: merged.series,
|
|
2710
|
+
containerMemory: await this.readContainerMemory({
|
|
2711
|
+
forNodeId: params.forNodeId,
|
|
2712
|
+
sinceMs,
|
|
2713
|
+
...params.sinceMs !== void 0 ? { exclusiveSinceMs: params.sinceMs } : {},
|
|
2714
|
+
bucketMs: merged.bucketMs,
|
|
2715
|
+
cadenceMs,
|
|
2716
|
+
origin: merged.oldestAtMs
|
|
2717
|
+
}),
|
|
2718
|
+
bucketMs: merged.bucketMs,
|
|
2719
|
+
retainedSamples: merged.retainedSamples,
|
|
2720
|
+
oldestAtMs: merged.oldestAtMs,
|
|
2721
|
+
cadenceMs,
|
|
2722
|
+
durable: history !== null
|
|
2723
|
+
};
|
|
2724
|
+
}
|
|
2725
|
+
/**
|
|
2726
|
+
* The container's memory over the same window, on the same x-axis.
|
|
2727
|
+
*
|
|
2728
|
+
* Both tiers, merged and deduped on `atMs` like the process series, then
|
|
2729
|
+
* reduced against the SAME `bucketMs` and the SAME origin — otherwise the
|
|
2730
|
+
* two series in one answer would sit on two different axes and the
|
|
2731
|
+
* subtraction they exist for would be an eyeball.
|
|
2732
|
+
*
|
|
2733
|
+
* An EMPTY answer means the node has no cgroup, or nothing has been retained
|
|
2734
|
+
* for it yet. It never means zero.
|
|
2735
|
+
*/
|
|
2736
|
+
async readContainerMemory(params) {
|
|
2737
|
+
const hot = this.memoryRing.read(params.forNodeId, params.exclusiveSinceMs);
|
|
2738
|
+
const history = this.metricsHistory;
|
|
2739
|
+
const merged = mergeContainerMemory(history === null ? [] : await history.readContainerPoints(params.forNodeId, params.sinceMs, 5e3), hot);
|
|
2740
|
+
if (params.bucketMs <= params.cadenceMs) return merged;
|
|
2741
|
+
return reduceContainerMemory(merged, params.bucketMs, params.origin ?? 0);
|
|
2742
|
+
}
|
|
2743
|
+
/**
|
|
2744
|
+
* Re-resolve the knobs and restate the fixed cadence.
|
|
2745
|
+
*
|
|
2746
|
+
* A REFUSED value (out of 5-60 s, or out of 1-72 h) leaves the previous
|
|
2747
|
+
* configuration in force and says so. Refused, never clamped: storing 10
|
|
2748
|
+
* when the operator typed 2 and reading 10 back is a knob and a readback
|
|
2749
|
+
* agreeing on a value nobody chose.
|
|
2750
|
+
*/
|
|
2751
|
+
applyLoadSeriesConfig() {
|
|
2752
|
+
try {
|
|
2753
|
+
const next = resolveLoadSeriesConfig({
|
|
2754
|
+
loadSeriesCadenceSec: this.config.loadSeriesCadenceSec,
|
|
2755
|
+
loadSeriesRetentionHours: this.config.loadSeriesRetentionHours
|
|
2756
|
+
});
|
|
2757
|
+
const changed = next.cadenceSec !== this.loadConfig.cadenceSec || next.retentionHours !== this.loadConfig.retentionHours;
|
|
2758
|
+
this.loadConfig = next;
|
|
2759
|
+
if (changed) {
|
|
2760
|
+
const projection = projectLoadSeriesCost({
|
|
2761
|
+
config: next,
|
|
2762
|
+
observedProcessRows: this.observedFleetRows()
|
|
2763
|
+
});
|
|
2764
|
+
this.ctx.logger.info("load series configuration applied", { meta: {
|
|
2765
|
+
nodeId: this.ctx.kernel.localNodeId ?? this.ctx.id,
|
|
2766
|
+
cadenceSec: next.cadenceSec,
|
|
2767
|
+
retentionHours: next.retentionHours,
|
|
2768
|
+
maxRows: next.maxRows,
|
|
2769
|
+
projectedRows: projection.intendedRows,
|
|
2770
|
+
projectedMib: Math.round(projection.estimatedBytes / 1048576 * 10) / 10,
|
|
2771
|
+
capBites: projection.capBites
|
|
2772
|
+
} });
|
|
2773
|
+
}
|
|
2774
|
+
} catch (err) {
|
|
2775
|
+
this.ctx.logger.warn("load series configuration REFUSED — keeping the previous values", { meta: {
|
|
2776
|
+
nodeId: this.ctx.kernel.localNodeId ?? this.ctx.id,
|
|
2777
|
+
cadenceSec: this.loadConfig.cadenceSec,
|
|
2778
|
+
retentionHours: this.loadConfig.retentionHours,
|
|
2779
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2780
|
+
} });
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
/**
|
|
2784
|
+
* (Re)arm the process-tree timer at the configured interval.
|
|
2785
|
+
*
|
|
2786
|
+
* The process-tree snapshot is FIXED-CADENCE, and its cadence is the
|
|
2787
|
+
* operator's `loadSeriesCadenceSec` (5-60 s, 10 by default).
|
|
2788
|
+
*
|
|
2789
|
+
* It used to emit only ON A CHANGE, with a 60 s fallback heartbeat, and the
|
|
2790
|
+
* dedup is gone rather than tuned. A conditional emit makes a hole in the
|
|
2791
|
+
* series mean two different things — "nothing changed" and "nobody reported"
|
|
2792
|
+
* — and telling those apart is the entire reason an operator opens this chart
|
|
2793
|
+
* after a spike. Now a gap means exactly one thing.
|
|
2794
|
+
*
|
|
2795
|
+
* It is not free: the emit rate is deterministic, so the durable table's row
|
|
2796
|
+
* count is too (nodes x processes / cadence, no discount for a quiet fleet).
|
|
2797
|
+
* The measured cost of that is in `docs/architecture/load-ledger.md`, and it
|
|
2798
|
+
* is why the retention default is six hours rather than three days.
|
|
2799
|
+
*/
|
|
2800
|
+
startProcessSnapshotTimer() {
|
|
2801
|
+
if (this.processSnapshotTimer) clearInterval(this.processSnapshotTimer);
|
|
2802
|
+
this.processSnapshotTimer = null;
|
|
2803
|
+
if (!this.ctxIfReady) return;
|
|
2804
|
+
this.processSnapshotTimer = setInterval(() => this.runTick("process snapshot", () => this.emitProcessesSnapshot()), this.loadConfig.cadenceSec * 1e3);
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Run one periodic tick so that it can NEVER become an unhandled rejection.
|
|
2808
|
+
*
|
|
2809
|
+
* `clearInterval` in `onShutdown` stops FUTURE ticks; it cannot recall one
|
|
2810
|
+
* already in flight. A process tick awaits a `/proc` read and a
|
|
2811
|
+
* `$process.list` broker call, and a graceful stop shuts this addon down
|
|
2812
|
+
* (nulling `ctx`) while the agent goes on to stop its other addons and the
|
|
2813
|
+
* broker — so the tick resumed with no context, its catch block reached for
|
|
2814
|
+
* `this.ctx.logger`, threw again, and the rejection of the timer callback
|
|
2815
|
+
* killed `docker stop CamStack-Agent` with exit code 1 (agent-a,
|
|
2816
|
+
* 2026-10-07 04:22Z). The ticks themselves now capture their context once
|
|
2817
|
+
* and stand down when it is gone; this wrapper is the backstop.
|
|
2818
|
+
*
|
|
2819
|
+
* A tick before `initialize()` or after `shutdown()` is a no-op.
|
|
2820
|
+
*/
|
|
2821
|
+
runTick(name, tick) {
|
|
2822
|
+
if (!this.ctxIfReady) return;
|
|
2823
|
+
tick().catch((err) => {
|
|
2824
|
+
this.ctxIfReady?.logger.warn("native-metrics tick failed — this interval will be missing", { meta: {
|
|
2825
|
+
tick: name,
|
|
2826
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2827
|
+
} });
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
async onShutdown() {
|
|
2831
|
+
if (this.snapshotTimer) {
|
|
2832
|
+
clearInterval(this.snapshotTimer);
|
|
2833
|
+
this.snapshotTimer = null;
|
|
2834
|
+
}
|
|
2835
|
+
if (this.processSnapshotTimer) {
|
|
2836
|
+
clearInterval(this.processSnapshotTimer);
|
|
2837
|
+
this.processSnapshotTimer = null;
|
|
2838
|
+
}
|
|
2839
|
+
this.provider?.stopSampling();
|
|
2840
|
+
this.provider = null;
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Resolve this node's short id (strips any `nodeId/addonId` suffix).
|
|
2844
|
+
* Returns null when the provider or event bus isn't available yet.
|
|
2845
|
+
*/
|
|
2846
|
+
resolveSnapshotNodeId(ctx) {
|
|
2847
|
+
if (!this.provider || !ctx.eventBus) return null;
|
|
2848
|
+
const rawNodeId = ctx.kernel.localNodeId ?? ctx.id;
|
|
2849
|
+
return rawNodeId.includes("/") ? rawNodeId.split("/")[0] : rawNodeId;
|
|
2850
|
+
}
|
|
2851
|
+
/**
|
|
2852
|
+
* Emit one `metrics.node-resources-snapshot` for this node. Cheap —
|
|
2853
|
+
* reads the cached sample (the provider's background sampler already
|
|
2854
|
+
* runs at samplingIntervalMs). Fires on METRICS_SNAPSHOT_INTERVAL_MS.
|
|
2855
|
+
*/
|
|
2856
|
+
async emitResourcesSnapshot() {
|
|
2857
|
+
const ctx = this.ctxIfReady;
|
|
2858
|
+
if (!ctx) return;
|
|
2859
|
+
const provider = this.provider;
|
|
2860
|
+
const eventBus = ctx.eventBus;
|
|
2861
|
+
const nodeId = this.resolveSnapshotNodeId(ctx);
|
|
2862
|
+
if (!provider || !eventBus || !nodeId) return;
|
|
2863
|
+
const timestamp = Date.now();
|
|
2864
|
+
try {
|
|
2865
|
+
const snapshot = await provider.getCached() ?? await provider.collectSnapshot();
|
|
2866
|
+
if (this.ctxIfReady !== ctx) return;
|
|
2867
|
+
const coarse = coarsenResourcesSnapshot(snapshot);
|
|
2868
|
+
const prev = this.lastResourcesEmit;
|
|
2869
|
+
const heartbeatDue = !prev || timestamp - prev.emittedAt >= METRICS_SNAPSHOT_HEARTBEAT_MS;
|
|
2870
|
+
if (!prev || prev.coarse !== coarse || heartbeatDue) {
|
|
2871
|
+
this.lastResourcesEmit = {
|
|
2872
|
+
coarse,
|
|
2873
|
+
emittedAt: timestamp
|
|
2874
|
+
};
|
|
2875
|
+
eventBus.emit(require_dist.createEvent(require_dist.EventCategory.MetricsNodeResourcesSnapshot, {
|
|
2876
|
+
type: "node",
|
|
2877
|
+
id: nodeId,
|
|
2878
|
+
nodeId
|
|
2879
|
+
}, {
|
|
2880
|
+
nodeId,
|
|
2881
|
+
snapshot,
|
|
2882
|
+
timestamp
|
|
2883
|
+
}));
|
|
2884
|
+
}
|
|
2885
|
+
} catch {}
|
|
2886
|
+
}
|
|
2887
|
+
/**
|
|
2888
|
+
* Emit one `metrics.node-processes-snapshot` for this node.
|
|
2889
|
+
*
|
|
2890
|
+
* Heavy — a full process-table read (`/proc` on Linux, `ps -eo` elsewhere;
|
|
2891
|
+
* `proc-process-table.ts`) plus a `$process.list` broker call — and
|
|
2892
|
+
* UNCONDITIONAL. The change-detection that used to guard it is gone: with a
|
|
2893
|
+
* fixed cadence a missing interval means exactly one thing, and that is the
|
|
2894
|
+
* property an operator investigating a spike is actually looking for.
|
|
2895
|
+
*
|
|
2896
|
+
* A failed scan emits nothing, which is the same signal: nobody reported.
|
|
2897
|
+
*/
|
|
2898
|
+
async emitProcessesSnapshot() {
|
|
2899
|
+
const ctx = this.ctxIfReady;
|
|
2900
|
+
if (!ctx) return;
|
|
2901
|
+
const eventBus = ctx.eventBus;
|
|
2902
|
+
const nodeId = this.resolveSnapshotNodeId(ctx);
|
|
2903
|
+
if (!this.provider || !eventBus || !nodeId) return;
|
|
2904
|
+
const timestamp = Date.now();
|
|
2905
|
+
try {
|
|
2906
|
+
const processes = await this.listNodeProcesses();
|
|
2907
|
+
if (this.ctxIfReady !== ctx) {
|
|
2908
|
+
ctx.logger.debug("process snapshot dropped — addon shut down mid-tick", { meta: { nodeId } });
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
const containerMemory = this.memoryProbe?.sample() ?? null;
|
|
2912
|
+
this.pidsProbe?.sample();
|
|
2913
|
+
eventBus.emit(require_dist.createEvent(require_dist.EventCategory.MetricsNodeProcessesSnapshot, {
|
|
2914
|
+
type: "node",
|
|
2915
|
+
id: nodeId,
|
|
2916
|
+
nodeId
|
|
2917
|
+
}, {
|
|
2918
|
+
nodeId,
|
|
2919
|
+
processes,
|
|
2920
|
+
timestamp,
|
|
2921
|
+
containerMemory
|
|
2922
|
+
}));
|
|
2923
|
+
} catch (err) {
|
|
2924
|
+
ctx.logger.warn("process snapshot skipped — this interval will be missing", { meta: {
|
|
2925
|
+
nodeId,
|
|
2926
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2927
|
+
} });
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
async onConfigChanged() {
|
|
2931
|
+
if (!this.ctxIfReady) return;
|
|
2932
|
+
this.provider?.stopSampling();
|
|
2933
|
+
this.provider?.startSampling(this.config.samplingIntervalMs);
|
|
2934
|
+
this.applyLoadSeriesConfig();
|
|
2935
|
+
this.startProcessSnapshotTimer();
|
|
2936
|
+
}
|
|
2937
|
+
async listWorkerInstances() {
|
|
2938
|
+
const broker = this.ctxIfReady?.kernel.cluster?.broker;
|
|
2939
|
+
if (!broker) return [];
|
|
2940
|
+
try {
|
|
2941
|
+
return await broker.call("$process.list");
|
|
2942
|
+
} catch {
|
|
2943
|
+
return [];
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
async listAddonInstances() {
|
|
2947
|
+
const hubNodeId = (this.ctx.kernel.cluster?.broker)?.nodeID ?? "hub";
|
|
2948
|
+
const uptimeSec = Math.max(0, Math.floor((Date.now() - this.startedAtMs) / 1e3));
|
|
2949
|
+
const instances = [{
|
|
2950
|
+
addonId: "$hub",
|
|
2951
|
+
nodeId: hubNodeId,
|
|
2952
|
+
role: "hub",
|
|
2953
|
+
pid: process.pid,
|
|
2954
|
+
state: "running",
|
|
2955
|
+
uptimeSec
|
|
2956
|
+
}];
|
|
2957
|
+
const workers = await this.listWorkerInstances();
|
|
2958
|
+
for (const w of workers) instances.push({
|
|
2959
|
+
addonId: w.addonId,
|
|
2960
|
+
nodeId: w.nodeId,
|
|
2961
|
+
role: "worker",
|
|
2962
|
+
pid: w.pid,
|
|
2963
|
+
state: narrowWorkerState(w.state),
|
|
2964
|
+
uptimeSec: w.uptimeSeconds
|
|
2965
|
+
});
|
|
2966
|
+
return instances;
|
|
2967
|
+
}
|
|
2968
|
+
async getAddonStats(addonId) {
|
|
2969
|
+
const provider = this.provider;
|
|
2970
|
+
if (!provider) return null;
|
|
2971
|
+
if (addonId === "$hub") return (await provider.getProcessStats({ pids: [process.pid] }))[0] ?? null;
|
|
2972
|
+
const target = (await this.listWorkerInstances()).find((w) => w.addonId === addonId);
|
|
2973
|
+
if (!target) return null;
|
|
2974
|
+
return (await provider.getProcessStats({ pids: [target.pid] }))[0] ?? null;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Walk the OS process table and classify each camstack-shaped process.
|
|
2978
|
+
*
|
|
2979
|
+
* Classification is IDENTITY-driven: `root` is this pid, `managed` is a pid
|
|
2980
|
+
* the kernel's `$process.list` names, and every other camstack-shaped
|
|
2981
|
+
* process is `system`. The rules — and why there is no longer an ancestry
|
|
2982
|
+
* walk behind them — live in `process-classification.ts`.
|
|
2983
|
+
*/
|
|
2984
|
+
async listNodeProcesses() {
|
|
2985
|
+
const selfNodeId = this.ctx.kernel.cluster?.broker?.nodeID ?? "hub";
|
|
2986
|
+
const ps = await this.runPs();
|
|
2987
|
+
if (ps.length === 0) return [];
|
|
2988
|
+
const managed = /* @__PURE__ */ new Map();
|
|
2989
|
+
const workers = await this.listWorkerInstances();
|
|
2990
|
+
for (const w of workers) managed.set(w.pid, {
|
|
2991
|
+
addonId: w.addonId,
|
|
2992
|
+
nodeId: w.nodeId
|
|
2993
|
+
});
|
|
2994
|
+
const camstackPids = ps.filter((p) => CAMSTACK_CMD_RE.test(p.command)).map((p) => p.pid);
|
|
2995
|
+
const cpuSplits = await this.threadCpu.sample(camstackPids);
|
|
2996
|
+
return buildNodeProcesses({
|
|
2997
|
+
psRows: ps,
|
|
2998
|
+
selfPid: process.pid,
|
|
2999
|
+
selfNodeId,
|
|
3000
|
+
managed,
|
|
3001
|
+
cpuSplits
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
/**
|
|
3005
|
+
* Every pid + command + resource stats on this node.
|
|
3006
|
+
*
|
|
3007
|
+
* From `/proc` on Linux — no fork. This used to be a `ps -eo` child on every
|
|
3008
|
+
* tick, i.e. a synchronous `fork()` of hub-main at p50 91 ms (D441, D452).
|
|
3009
|
+
* `ps` remains the source only on a platform without `/proc`.
|
|
3010
|
+
*/
|
|
3011
|
+
async runPs() {
|
|
3012
|
+
try {
|
|
3013
|
+
return await readProcessTable();
|
|
3014
|
+
} catch (err) {
|
|
3015
|
+
this.ctxIfReady?.logger.warn("process table read failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
3016
|
+
return [];
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* The knobs live HERE, on the document this addon already owns.
|
|
3021
|
+
*
|
|
3022
|
+
* Fields on an existing document, never a method per knob —
|
|
3023
|
+
* `system.getLoggingSettings` / `setLoggingSettings` set that precedent.
|
|
3024
|
+
* They are deliberately NOT in the logging document: that one is about
|
|
3025
|
+
* levels and diagnostic windows, and two documents both claiming a knob is
|
|
3026
|
+
* how this repo has already shipped a switch nobody read.
|
|
3027
|
+
*
|
|
3028
|
+
* Cluster-wide, not per-node: every node must emit on the same cadence or
|
|
3029
|
+
* the fleet's series cannot be laid over each other, and the table is single
|
|
3030
|
+
* and hub-resident, so a per-node retention would be a promise nothing could
|
|
3031
|
+
* keep.
|
|
3032
|
+
*
|
|
3033
|
+
* The cost line is computed from OBSERVED numbers — the nodes and process
|
|
3034
|
+
* counts the cluster is actually reporting — so an operator raising the
|
|
3035
|
+
* retention sees what it costs BEFORE applying it, not afterwards.
|
|
3036
|
+
*/
|
|
3037
|
+
globalSettingsSchema() {
|
|
3038
|
+
const projection = projectLoadSeriesCost({
|
|
3039
|
+
config: this.loadConfig,
|
|
3040
|
+
observedProcessRows: this.observedFleetRows()
|
|
3041
|
+
});
|
|
3042
|
+
return this.schema({ sections: [{
|
|
3043
|
+
id: "native-metrics-settings",
|
|
3044
|
+
title: "System Metrics",
|
|
3045
|
+
titleKey: "server:globalSettings.s_native-metrics-settings.title",
|
|
3046
|
+
fields: [this.field({
|
|
3047
|
+
type: "number",
|
|
3048
|
+
key: "samplingIntervalMs",
|
|
3049
|
+
label: "Sampling Interval",
|
|
3050
|
+
labelKey: "server:globalSettings.s_native-metrics-settings.samplingIntervalMs.label",
|
|
3051
|
+
description: "How often to collect system metrics",
|
|
3052
|
+
descriptionKey: "server:globalSettings.s_native-metrics-settings.samplingIntervalMs.description",
|
|
3053
|
+
min: 1e3,
|
|
3054
|
+
max: 6e4,
|
|
3055
|
+
step: 1e3,
|
|
3056
|
+
default: 5e3,
|
|
3057
|
+
unit: "ms"
|
|
3058
|
+
})]
|
|
3059
|
+
}, {
|
|
3060
|
+
id: "native-metrics-load-series",
|
|
3061
|
+
title: "Load history",
|
|
3062
|
+
titleKey: "server:globalSettings.s_native-metrics-load-series.title",
|
|
3063
|
+
fields: [
|
|
3064
|
+
this.field({
|
|
3065
|
+
type: "number",
|
|
3066
|
+
key: "loadSeriesCadenceSec",
|
|
3067
|
+
label: "Sampling cadence",
|
|
3068
|
+
labelKey: "server:globalSettings.s_native-metrics-load-series.loadSeriesCadenceSec.label",
|
|
3069
|
+
description: "How often every node reports its process tree. FIXED — a sample is emitted on every interval whether or not anything changed, so a gap in the chart means one thing only: nobody reported. Outside 5-60 s the value is refused.",
|
|
3070
|
+
descriptionKey: "server:globalSettings.s_native-metrics-load-series.loadSeriesCadenceSec.description",
|
|
3071
|
+
min: 5,
|
|
3072
|
+
max: 60,
|
|
3073
|
+
step: 1,
|
|
3074
|
+
default: 10,
|
|
3075
|
+
unit: "s"
|
|
3076
|
+
}),
|
|
3077
|
+
this.field({
|
|
3078
|
+
type: "number",
|
|
3079
|
+
key: "loadSeriesRetentionHours",
|
|
3080
|
+
label: "Retention",
|
|
3081
|
+
labelKey: "server:globalSettings.s_native-metrics-load-series.loadSeriesRetentionHours.label",
|
|
3082
|
+
description: "How long the load history is kept on disk (the hub database, on the NVMe cache — never the recordings disk). This is the INTENTION; the row cap below is the guarantee.",
|
|
3083
|
+
descriptionKey: "server:globalSettings.s_native-metrics-load-series.loadSeriesRetentionHours.description",
|
|
3084
|
+
min: 1,
|
|
3085
|
+
max: 72,
|
|
3086
|
+
step: 1,
|
|
3087
|
+
default: 6,
|
|
3088
|
+
unit: "h"
|
|
3089
|
+
}),
|
|
3090
|
+
{
|
|
3091
|
+
type: "info",
|
|
3092
|
+
key: "load-series-cost",
|
|
3093
|
+
label: "What this configuration costs",
|
|
3094
|
+
labelKey: "server:globalSettings.s_native-metrics-load-series.load-series-cost.label",
|
|
3095
|
+
content: describeLoadSeriesCost(projection),
|
|
3096
|
+
variant: projection.capBites ? "warning" : "info"
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
type: "info",
|
|
3100
|
+
key: "load-series-cap",
|
|
3101
|
+
label: "Hard row cap",
|
|
3102
|
+
labelKey: "server:globalSettings.s_native-metrics-load-series.load-series-cap.label",
|
|
3103
|
+
content: `The table never exceeds ${this.loadConfig.maxRows.toLocaleString("en-US")} rows. When it would, the OLDEST samples are evicted and a warning is logged — so raising the retention can never turn into an incident, only into a shorter effective window.`,
|
|
3104
|
+
variant: "info"
|
|
3105
|
+
}
|
|
3106
|
+
]
|
|
3107
|
+
}] });
|
|
3108
|
+
}
|
|
3109
|
+
};
|
|
3110
|
+
//#endregion
|
|
3111
|
+
exports.NativeMetricsProvider = NativeMetricsProvider;
|
|
3112
|
+
exports.default = NativeMetricsAddon;
|
|
3113
|
+
exports.lifetimeCpuPercent = lifetimeCpuPercent;
|
|
3114
|
+
exports.nodeProcReader = nodeProcReader;
|
|
3115
|
+
exports.parseProcStat = parseProcStat;
|
|
3116
|
+
exports.parseProcStatusRss = parseProcStatusRss;
|