Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
"test:e2e": "pnpm --filter e2e-tests test:e2e",
"test": "pnpm --filter e2e-tests test"
},
"devDependencies": {}
"devDependencies": {},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild",
"rescript"
]
}
}
15 changes: 15 additions & 0 deletions packages/cli/CommandLineHelp.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This document contains the help content for the `envio` command-line program.
* [`envio local db-migrate down`↴](#envio-local-db-migrate-down)
* [`envio local db-migrate setup`↴](#envio-local-db-migrate-setup)
* [`envio start`↴](#envio-start)
* [`envio profile`↴](#envio-profile)

## `envio`

Expand All @@ -41,6 +42,7 @@ This document contains the help content for the `envio` command-line program.
* `codegen` — Generate indexing code from user-defined configuration & schema files
* `local` — Prepare local environment for envio testing
* `start` — Start the indexer without any automatic codegen
* `profile` — Profile the running indexer by fetching and analyzing /metrics

###### **Options:**

Expand Down Expand Up @@ -350,4 +352,17 @@ Start the indexer without any automatic codegen



## `envio profile`

Profile the running indexer by fetching and analyzing /metrics

**Usage:** `envio profile [OPTIONS]`

###### **Options:**

* `-u`, `--url <URL>` — Full URL of the indexer (e.g. http://localhost:9898). Overrides host/port env vars
* `--duration <DURATION>` — Sample metrics over this many seconds for rate-based insights (e.g. events/sec, effect RPS). Without this flag, a single snapshot is taken

Comment on lines +355 to +365

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

Fix MD001 heading-level jump in the new envio profile section (and consider naming the env vars).

markdownlint flags Line 361 because ###### (h6) jumps multiple levels after the ## section header. Also, the help text says “Overrides host/port env vars” but doesn’t name them (the implementation reads ENVIO_INDEXER_HOST / ENVIO_INDEXER_PORT).

Proposed doc tweak (keeps formatting similar but avoids a heading)
 ## `envio profile`

 Profile the running indexer by fetching and analyzing /metrics

 **Usage:** `envio profile [OPTIONS]`

-###### **Options:**
+**Options:**

-* `-u`, `--url <URL>` — Full URL of the indexer (e.g. http://localhost:9898). Overrides host/port env vars
+* `-u`, `--url <URL>` — Full URL of the indexer (e.g. http://localhost:9898). Overrides `ENVIO_INDEXER_HOST` / `ENVIO_INDEXER_PORT`
 * `--duration <DURATION>` — Sample metrics over this many seconds for rate-based insights (e.g. events/sec, effect RPS). Without this flag, a single snapshot is taken
📝 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
## `envio profile`
Profile the running indexer by fetching and analyzing /metrics
**Usage:** `envio profile [OPTIONS]`
###### **Options:**
* `-u`, `--url <URL>` — Full URL of the indexer (e.g. http://localhost:9898). Overrides host/port env vars
* `--duration <DURATION>` — Sample metrics over this many seconds for rate-based insights (e.g. events/sec, effect RPS). Without this flag, a single snapshot is taken
## `envio profile`
Profile the running indexer by fetching and analyzing /metrics
**Usage:** `envio profile [OPTIONS]`
**Options:**
* `-u`, `--url <URL>` — Full URL of the indexer (e.g. http://localhost:9898). Overrides `ENVIO_INDEXER_HOST` / `ENVIO_INDEXER_PORT`
* `--duration <DURATION>` — Sample metrics over this many seconds for rate-based insights (e.g. events/sec, effect RPS). Without this flag, a single snapshot is taken
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 361-361: 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 the current code and only fix it if needed.

In `@packages/cli/CommandLineHelp.md` around lines 355 - 365, The "envio profile"
docs introduce an h6 ("###### **Options:**") after an h2 which triggers MD001;
replace the h6 with a non-heading option label (e.g., bold "Options:" or a
level-3/4 heading) to preserve nesting and linting, and update the option
description text to explicitly name the environment variables read by the
implementation (ENVIO_INDEXER_HOST and ENVIO_INDEXER_PORT) instead of saying
"Overrides host/port env vars"; locate and edit the `envio profile` section in
CommandLineHelp.md and update the Options label and the `--url` description
accordingly.




14 changes: 14 additions & 0 deletions packages/cli/src/cli_args/clap_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ pub enum CommandType {
///Start the indexer without any automatic codegen
Start(StartArgs),

///Profile the running indexer by fetching and analyzing /metrics
Profile(ProfileArgs),

#[clap(hide = true)]
#[command(subcommand)]
Script(Script),
Expand Down Expand Up @@ -92,6 +95,17 @@ pub struct StartArgs {
pub restart: bool,
}

#[derive(Debug, Args)]
pub struct ProfileArgs {
///Full URL of the indexer (e.g. http://localhost:9898). Overrides host/port env vars.
#[arg(short, long)]
pub url: Option<String>,

///Sample metrics over this many seconds for rate-based insights (e.g. events/sec, effect RPS). Without this flag, a single snapshot is taken.
#[arg(long)]
pub duration: Option<u64>,
}

#[derive(Debug, Subcommand)]
pub enum LocalCommandTypes {
/// Local Envio environment commands
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod codegen;
mod dev;
pub mod init;
mod local;
mod profile;

use anyhow::{Context, Result};
use schemars::schema_for;
Expand Down Expand Up @@ -74,6 +75,10 @@ pub async fn execute(command_line_args: CommandLineArgs) -> Result<()> {
commands::start::start_indexer(&config).await?;
}

CommandType::Profile(profile_args) => {
profile::run_profile(profile_args).await?;
}

CommandType::Local(local_commands) => {
local::run_local(&local_commands, &parsed_project_paths).await?;
}
Expand Down
Loading