---
title: vercel metrics
product: vercel
url: /docs/cli/metrics
type: reference
prerequisites:
  - /docs/cli
related:
  - /docs/observability/observability-plus
summary: Learn about vercel metrics on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# vercel metrics

> **🔒 Permissions Required**: Metrics

The `vercel metrics` command lets you query observability data for your teams and projects. You can also inspect the schema to list available metrics, or inspect a metric or metric prefix to discover valid aggregations and dimensions before running a query.

This command requires [Observability Plus](/docs/observability/observability-plus).

## Usage

```bash filename="terminal"
# Query metrics for the linked project
vercel metrics --metric vercel.edge_requests.count

# Query a specific project by name or ID
vercel metrics --project my-app --metric vercel.edge_requests.count --group-by route --since 24h

# Query metrics across all projects in the current team
vercel metrics --all --metric vercel.edge_requests.count --group-by project_id --since 24h

# Inspect the schema for a metric prefix
vercel metrics schema --metric vercel.edge_requests
```

*Using the \`vercel metrics\` command to query observability data or inspect the
available schema for an event.*

## Query output

By default, `vercel metrics` prints a human-readable table or time series summary. Use `--format json` to output structured JSON for automation or agents.

## Unique options

These options only apply to the `vercel metrics` command.

### Metric

The `--metric` option, shorthand `-m`, specifies the metric id to query. This option is required.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count
```

To list all available metrics, use:

```bash filename="terminal"
vercel metrics schema
```

To inspect a metric or metric prefix and see its available aggregations and dimensions, use:

```bash filename="terminal"
vercel metrics schema --metric vercel.edge_requests
```

### Aggregation

The `--aggregation` option, shorthand `-a`, specifies the aggregation function for the selected metric.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.request_duration_ms --aggregation p95
```

If omitted, the CLI uses the default aggregation from the metric schema.

### Group-by

The `--group-by` option groups results by one or more dimensions. Repeat it to group by multiple dimensions.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --group-by route
vercel metrics --metric vercel.edge_requests.count --group-by project_id --group-by route
```

### Filter

The `--filter` option, shorthand `-f`, applies an OData filter expression.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --filter "route eq '/api/logs'"
```

### Since

The `--since` option sets the start of the time range. You can use a relative duration like `1h`, `24h`, or `7d`, or an ISO timestamp. If omitted, the CLI defaults to the last hour.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --since 24h
```

### Until

The `--until` option sets the end of the time range. If omitted, the command uses the current time.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --since 24h --until 2026-03-19T12:00:00Z
```

### Granularity

The `--granularity` option, shorthand `-g`, controls the time bucket size. If omitted, the CLI computes an appropriate granularity for the selected time range.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --granularity 1h --since 7d
```

### Limit

The `--limit` option sets the maximum number of grouped results returned per time bucket. The default is `10`.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --group-by route --limit 50
```

### Project

The `--project` option, shorthand `-p`, specifies the project name or project ID to query. It defaults to the linked project when `--all` is not set.

```bash filename="terminal"
vercel metrics --project my-app --metric vercel.edge_requests.count
vercel metrics --project prj_123456789 --metric vercel.edge_requests.count
```

### All

The `--all` option queries across all projects in the current team scope. It cannot be combined with `--project`.

```bash filename="terminal"
vercel metrics --all --metric vercel.edge_requests.count --group-by project_id
```

### Format

The `--format` option outputs JSON instead of text. This is useful for automation and agents.

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --format json
vercel metrics schema --metric vercel.edge_requests --format json
```

## Schema subcommand

Use the `schema` subcommand to:

- list all available metrics with `vercel metrics schema`
- inspect the dimensions and aggregations supported for a specific metric or metric prefix with `vercel metrics schema --metric <metric-id-or-prefix>`

```bash filename="terminal"
vercel metrics schema
vercel metrics schema --metric vercel.edge_requests
vercel metrics schema --metric vercel.edge_requests.count --format json
```

This is useful when building queries interactively or scripting queries that need to validate available fields first.

## Examples

Query request volume by route for the last 24 hours:

```bash filename="terminal"
vercel metrics --metric vercel.edge_requests.count --aggregation sum --group-by route --since 24h
```

Query p95 latency by route for a specific project:

```bash filename="terminal"
vercel metrics --project my-app --metric vercel.edge_requests.request_duration_ms --aggregation p95 --group-by route --since 24h
```

Query team-wide traffic grouped by project:

```bash filename="terminal"
vercel metrics --all --metric vercel.edge_requests.count --aggregation sum --group-by project_id --since 24h
```

Inspect the schema before building a query:

```bash filename="terminal"
vercel metrics schema --metric vercel.edge_requests
```


---

[View full sitemap](/docs/sitemap)
