Skip to content

feat: add CLI metrics collection and stats command#29

Closed
SegovChik wants to merge 1 commit into
NVIDIA:mainfrom
SegovChik:feat/add-cli-metrics-and-stats
Closed

feat: add CLI metrics collection and stats command#29
SegovChik wants to merge 1 commit into
NVIDIA:mainfrom
SegovChik:feat/add-cli-metrics-and-stats

Conversation

@SegovChik

@SegovChik SegovChik commented Mar 16, 2026

Copy link
Copy Markdown

Summary

Closes #30

  • Add lightweight, local-only usage metrics to the NemoClaw CLI
  • Events stored as JSONL at ~/.nemoclaw/metrics.jsonl — never leave the machine
  • New nemoclaw stats command for aggregate and per-sandbox usage visibility
  • Best-effort recording (never crashes the CLI on failure)

What's tracked

Event Trigger
onboard_start / onboard_complete Setup wizard
sandbox_connect Each sandbox connection
sandbox_destroy Sandbox deletion
policy_apply Policy preset application

New commands

nemoclaw stats              # Aggregate metrics across all sandboxes
nemoclaw stats --reset      # Clear all recorded metrics
nemoclaw <name> stats       # Per-sandbox metrics

Changes

  • New: bin/lib/metrics.js — core metrics module (JSONL recording, filtering, aggregation)
  • New: test/metrics.test.js — 10 unit tests using node:test
  • Modified: bin/nemoclaw.js — added stats commands + instrumented existing commands

Design decisions

  • JSONL format — append-only, no file locking needed, easy to parse
  • Best-effort — all metric recording is wrapped in try/catch, never affects CLI behavior
  • Zero new dependencies — only Node.js built-ins (fs, path)
  • Local-only — no network calls, no telemetry, data stays on the machine

Test plan

Add lightweight, best-effort usage metrics to the NemoClaw CLI.
Events are stored locally as JSONL at ~/.nemoclaw/metrics.jsonl
and never leave the machine.

Tracked events:
- onboard_start / onboard_complete
- sandbox_connect / sandbox_destroy
- policy_apply (with preset name)

New commands:
- nemoclaw stats            — aggregate metrics across all sandboxes
- nemoclaw stats --reset    — clear all recorded metrics
- nemoclaw <name> stats     — per-sandbox metrics

New files:
- bin/lib/metrics.js        — metrics recording, filtering, aggregation
- test/metrics.test.js      — 10 unit tests (node:test)

No new dependencies. All 48 tests pass.

Signed-off-by: segovchik <segovchik@gmail.com>
@SegovChik

Copy link
Copy Markdown
Author

@ericksoa — This adds basic local-only usage metrics to the CLI (nemoclaw stats). No new deps, does not break tests, JSONL format. Would appreciate a review when you have a moment!

@wscurran

Copy link
Copy Markdown
Contributor

Thanks for adding lightweight, local metrics collection to the NemoClaw CLI and introducing the nemoclaw stats command for usage visibility, which should provide valuable insights without compromising user privacy.

@cv cv closed this Mar 24, 2026
jessesanford pushed a commit to jessesanford/NemoClaw that referenced this pull request Mar 24, 2026
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output area: observability Logging, metrics, tracing, diagnostics, or debug output feature PR adds or expands user-visible functionality and removed priority: medium labels Jun 3, 2026
@cv cv mentioned this pull request Jun 5, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: observability Logging, metrics, tracing, diagnostics, or debug output feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add basic usage metrics and observability to CLI

3 participants