Skip to content

Metrics command group#468

Open
nblumhardt wants to merge 9 commits into
datalust:devfrom
nblumhardt:metrics-commands-2
Open

Metrics command group#468
nblumhardt wants to merge 9 commits into
datalust:devfrom
nblumhardt:metrics-commands-2

Conversation

@nblumhardt
Copy link
Copy Markdown
Member

This uncovers a panic in the current Seq 2026.1 preview, so may not build/be mergeable until we've pushed up a fix for that.

Adds basic CLI commands for interacting with metrics, and matching MCP tools.

Usage: seqcli metrics <sub-command> [<args>]

Available sub-commands are:
  dimension   List distinct values for a metric dimension
  dimensions  List the dimensions associated with a given metric
  search      List available metric definitions
seqcli metrics search [<args>]

List available metric definitions

Example:
  seqcli metrics search -f "@Resource.service.name = 'proxy'" -c 512

Arguments:
  -f, --filter=VALUE         A filter to apply to the search, including metric
                               name/description text in double quotes, for
                               example `"cpu" and Host = 'xmpweb-01.example.
                               com'`
  -g, --group=VALUE          Group key for metric definition breakdown; this
                               argument can be used multiple times
  -c, --count=VALUE          The maximum number of metric definitions to
                               retrieve; the default is 30
      --start=VALUE          ISO 8601 date/time to query from
      --end=VALUE            ISO 8601 date/time to query to
      --json                 Print output in newline-delimited JSON (the
                               default is plain text)
      --no-color             Don't colorize text output
      --force-color          Force redirected output to have ANSI color (
                               unless `--no-color` is also specified)
      --storage=VALUE        The folder where `SeqCli.json` and other data
                               will be stored; falls back to `SEQCLI_STORAGE_
                               PATH` from the environment, then the `seqcli
                               forwarder` service's configured storage path (
                               Windows only), then `/home/nblumhardt`
      --trace                Enable detailed (server-side) query tracing
  -s, --server=VALUE         The URL of the Seq server; by default the `
                               connection.serverUrl` config value will be used
  -a, --apikey=VALUE         The API key to use when connecting to the server;
                               by default the `connection.apiKey` config
                               value will be used
      --profile=VALUE        A connection profile to use; by default the `
                               connection.serverUrl` and `connection.apiKey`
                               config values will be used
      --verbose              Print verbose output to `STDERR`
seqcli metrics dimensions [<args>]

List the dimensions associated with a given metric

Example:
  seqcli metrics dimensions -m http.response.status_code

Arguments:
  -m, --metric=VALUE         A metric name, for example `hats-sold` or `http.
                               request.duration`; omit to list dimensions for
                               all metrics
  -c, --count=VALUE          The maximum number of dimensions to retrieve; the
                               default is 30
      --start=VALUE          ISO 8601 date/time to query from
      --end=VALUE            ISO 8601 date/time to query to
      --json                 Print output in newline-delimited JSON (the
                               default is plain text)
      --no-color             Don't colorize text output
      --force-color          Force redirected output to have ANSI color (
                               unless `--no-color` is also specified)
      --storage=VALUE        The folder where `SeqCli.json` and other data
                               will be stored; falls back to `SEQCLI_STORAGE_
                               PATH` from the environment, then the `seqcli
                               forwarder` service's configured storage path (
                               Windows only), then `/home/nblumhardt`
      --trace                Enable detailed (server-side) query tracing
  -s, --server=VALUE         The URL of the Seq server; by default the `
                               connection.serverUrl` config value will be used
  -a, --apikey=VALUE         The API key to use when connecting to the server;
                               by default the `connection.apiKey` config
                               value will be used
      --profile=VALUE        A connection profile to use; by default the `
                               connection.serverUrl` and `connection.apiKey`
                               config values will be used
      --verbose              Print verbose output to `STDERR`
seqcli metrics dimension [<args>]

List distinct values for a metric dimension

Example:
  seqcli metrics dimension --accessor @Resource.service.name

Arguments:
  -d, --accessor=VALUE       The dimension accessor, e.g. `cpu.mode`
  -c, --count=VALUE          The maximum number of dimensions to retrieve; the
                               default is 30
      --start=VALUE          ISO 8601 date/time to query from
      --end=VALUE            ISO 8601 date/time to query to
      --json                 Print output in newline-delimited JSON (the
                               default is plain text)
      --native               Print output using Seq's native value syntax (
                               ideal for agent usage)
      --no-color             Don't colorize text output
      --force-color          Force redirected output to have ANSI color (
                               unless `--no-color` is also specified)
      --storage=VALUE        The folder where `SeqCli.json` and other data
                               will be stored; falls back to `SEQCLI_STORAGE_
                               PATH` from the environment, then the `seqcli
                               forwarder` service's configured storage path (
                               Windows only), then `/home/nblumhardt`
      --trace                Enable detailed (server-side) query tracing
  -s, --server=VALUE         The URL of the Seq server; by default the `
                               connection.serverUrl` config value will be used
  -a, --apikey=VALUE         The API key to use when connecting to the server;
                               by default the `connection.apiKey` config
                               value will be used
      --profile=VALUE        A connection profile to use; by default the `
                               connection.serverUrl` and `connection.apiKey`
                               config values will be used
      --verbose              Print verbose output to `STDERR`

The MCP endpoints follow largely the same pattern. We'll need a new skill to cover metrics, which I'll kick off and add to the PR shortly. Some iteration/testing is going to be needed, it's not clear just yet how well agents will go using metrics this way.

The commands, command tests, and MCP tool are written by hand. I used Claude to port the command tests over to cover the MCP endpoints.

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