Skip to content

feat(telemetry): add system metrics collection - #1435

Merged
7Sageer merged 2 commits into
mainfrom
feat/telemetry-system-metrics
Jul 6, 2026
Merged

feat(telemetry): add system metrics collection#1435
7Sageer merged 2 commits into
mainfrom
feat/telemetry-system-metrics

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This PR adds internal process resource telemetry for Kimi Code hosts.

Problem

Kimi Code telemetry currently has no visibility into host process resource usage. When investigating memory growth, CPU spikes, or resource exhaustion across CLI/TUI/server sessions, there is no runtime signal to correlate with existing telemetry events.

What changed

  • Added a SystemMetricsCollector that emits a system_metrics telemetry event with CPU, memory, load, and process uptime fields.
  • The collector performs one warmup sample shortly after startup so short-lived CLI runs still capture a baseline, then continues sampling every 30 seconds.
  • Wired the collector into telemetry bootstrap so it follows the existing telemetry opt-in/opt-out path and attaches to the same telemetry client.
  • Added lifecycle cleanup so replacing, disabling, shutting down, or resetting telemetry stops the collector and avoids duplicate interval timers.
  • Added tests for warmup sampling, duplicate-start protection, collector replacement cleanup, and bootstrap-level system_metrics emission with session context.

Verification:

  • pnpm --filter @moonshot-ai/kimi-telemetry test
  • pnpm --filter @moonshot-ai/kimi-telemetry typecheck

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Add periodic CPU and memory telemetry sampling with warmup capture, lifecycle cleanup, and tests.
@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 69f826d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 6, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@69f826d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@69f826d

commit: 69f826d

@7Sageer
7Sageer merged commit 10922fc into main Jul 6, 2026
10 checks passed
@7Sageer
7Sageer deleted the feat/telemetry-system-metrics branch July 6, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant