Skip to content

Add envio metrics runtime subcommand#1281

Merged
DZakh merged 2 commits into
mainfrom
claude/loving-dirac-Ax0MF
Jun 4, 2026
Merged

Add envio metrics runtime subcommand#1281
DZakh merged 2 commits into
mainfrom
claude/loving-dirac-Ax0MF

Conversation

@DZakh
Copy link
Copy Markdown
Member

@DZakh DZakh commented Jun 4, 2026

Summary

Adds a new envio metrics runtime subcommand to fetch runtime-specific metrics from the indexer's /metrics/runtime endpoint, while maintaining backward compatibility with the existing envio metrics command that fetches from /metrics.

Changes

  • CLI argument definitions: Converted Metrics command from a simple unit variant to Metrics(MetricsArgs) that accepts an optional subcommand
  • Metrics subcommand: Added MetricsSubcommand enum with Runtime variant to support the new runtime subcommand
  • Metrics executor: Updated run() function to accept a runtime boolean parameter that determines which endpoint to query (/metrics/runtime vs /metrics)
  • Command executor: Modified metrics command handler to extract the subcommand and pass the runtime flag to the executor
  • Documentation: Updated CommandLineHelp.md to reflect the new subcommand structure and usage

Implementation Details

  • The runtime flag is determined by checking if the subcommand matches MetricsSubcommand::Runtime
  • The endpoint path is conditionally set based on the flag, maintaining a single code path for the HTTP request logic
  • The change is backward compatible: calling envio metrics without a subcommand still works and queries the default /metrics endpoint

https://claude.ai/code/session_01FruGiMDrPPWC2wL3KjxFb4

Summary by CodeRabbit

  • New Features

    • Added envio metrics runtime subcommand to retrieve and display runtime-specific metrics from a dedicated endpoint.
    • Restructured metrics command to support subcommands, enabling organized access to different types of metrics data.
  • Documentation

    • Updated CLI help documentation to reflect new envio metrics runtime subcommand and its usage.

claude added 2 commits June 4, 2026 08:12
Lets `envio metrics --runtime` fetch the indexer's /metrics/runtime
endpoint instead of the default /metrics.

https://claude.ai/code/session_01FruGiMDrPPWC2wL3KjxFb4
`envio metrics runtime` fetches the indexer's /metrics/runtime endpoint;
`envio metrics` still fetches /metrics.

https://claude.ai/code/session_01FruGiMDrPPWC2wL3KjxFb4
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the envio metrics CLI command to support a new runtime subcommand that fetches runtime-specific metrics from the /metrics/runtime endpoint. The change introduces nested subcommand argument parsing, parameterizes the metrics endpoint handler, updates command dispatch logic, and documents the new subcommand in the CLI help.

Changes

Runtime Metrics Subcommand

Layer / File(s) Summary
Metrics argument types and structures
packages/cli/src/cli_args/clap_definitions.rs
CommandType::Metrics is updated from a unit variant to carry MetricsArgs. New MetricsArgs struct contains an optional subcommand field, and new MetricsSubcommand enum adds a Runtime variant for runtime metrics.
Runtime metrics endpoint handler
packages/cli/src/executor/metrics.rs
metrics::run() is parameterized to accept a runtime: bool argument and conditionally constructs the request URL as /metrics or /metrics/runtime based on the flag.
Command dispatcher and wiring
packages/cli/src/executor/mod.rs
Imports MetricsSubcommand and updates the CommandType::Metrics match arm to destructure metrics arguments, extract the runtime subcommand state, and pass it to metrics::run(runtime).
CLI help documentation
packages/cli/CommandLineHelp.md
Adds envio metrics runtime to the table of contents and replaces the standalone metrics usage section with a [COMMAND] subcommand structure that documents the runtime option.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new envio metrics runtime subcommand to the CLI.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/CommandLineHelp.md`:
- Around line 383-386: The markdown has a heading level jump: replace the
"###### **Subcommands:**" heading with a heading level that matches the
surrounding section hierarchy (e.g., change to "## Subcommands:" or the
appropriate level used nearby) so it no longer jumps from h2 to h6; update the
"Subcommands" heading that contains the `runtime` bullet (the runtime metrics
list item) to the corrected heading level to satisfy markdownlint MD001.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 008bc790-a38a-4da2-ac18-da83686c814a

📥 Commits

Reviewing files that changed from the base of the PR and between eceab32 and 553612f.

📒 Files selected for processing (4)
  • packages/cli/CommandLineHelp.md
  • packages/cli/src/cli_args/clap_definitions.rs
  • packages/cli/src/executor/metrics.rs
  • packages/cli/src/executor/mod.rs

Comment on lines +383 to +386
###### **Subcommands:**

* `runtime` — Fetch runtime metrics from the running indexer's /metrics/runtime endpoint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix markdown heading-level jump in the new metrics subsection.

Line 383 introduces a heading level jump (h2h6), which triggers markdownlint MD001 in this diff.

Suggested change
-###### **Subcommands:**
+**Subcommands:**
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
###### **Subcommands:**
* `runtime` — Fetch runtime metrics from the running indexer's /metrics/runtime endpoint
**Subcommands:**
* `runtime` — Fetch runtime metrics from the running indexer's /metrics/runtime endpoint
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 383-383: Heading levels should only increment by one level at a time
Expected: h3; Actual: h6

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/CommandLineHelp.md` around lines 383 - 386, The markdown has a
heading level jump: replace the "###### **Subcommands:**" heading with a heading
level that matches the surrounding section hierarchy (e.g., change to "##
Subcommands:" or the appropriate level used nearby) so it no longer jumps from
h2 to h6; update the "Subcommands" heading that contains the `runtime` bullet
(the runtime metrics list item) to the corrected heading level to satisfy
markdownlint MD001.

@DZakh DZakh merged commit a6add8a into main Jun 4, 2026
7 of 8 checks passed
@DZakh DZakh deleted the claude/loving-dirac-Ax0MF branch June 4, 2026 11:22
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.

2 participants