---
title: "overlane observe metrics"
description: "Total one kind of metric by agent, project, team, pull request or task"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.overlane.app/llms.txt
> Use this file to discover all available pages before exploring further.

# overlane observe metrics

{/* Generated by apps/docs/scripts/generate.mjs (CLI pages from the command registry in packages/cli). Do not edit; run `pnpm --filter @overlane/docs gen`. */}

Adds up the metrics runs reported: cost, tokens, tool calls, successes, failures or latency, grouped by agent (default), project, team, pull request or task, optionally from a start time. For the cost view, see `overlane observe cost`.

## Usage

```sh
overlane observe metrics [--kind KIND] [--by DIMENSION] [--from TIMESTAMP] [--service URL] [--team TENANT_ID]
```

## Flags

| Flag | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--kind` | one of `cost_micros`, `tokens`, `tool_calls`, `success`, `failure`, `latency_ms` | no | `cost_micros` | What to total (default cost_micros) |
| `--by` | one of `agent`, `project`, `team`, `pr`, `task` | no | `agent` | What to group by (default agent) |
| `--from` | string | no |  | Only metrics at or after this time (ISO 8601) |
| `--service` | string | no |  | The service address (default: OVERLANE_SERVICE_URL, then the project's binding, then the hosted service) |
| `--team` | string | no |  | The team (tenant) to act on (default: the one your token belongs to) |

## Examples

```sh
overlane observe metrics
overlane observe metrics --kind tokens --by project --json
```

## Behavior

- Effect: `read` (changes nothing).
- Needs credentials: yes. Uses the network: yes.
- Supports `--dry-run`: no. Accepts `--force`: no.
- Machine-readable description: `overlane schema observe metrics`.

## Result

With `--json` (the default when stdout is not a terminal) the command prints this JSON Schema's shape on stdout.

```json
{
  "type": "object",
  "properties": {
    "tenantId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
      "description": "tenant identifier"
    },
    "kind": {
      "type": "string",
      "enum": [
        "cost_micros",
        "tokens",
        "tool_calls",
        "success",
        "failure",
        "latency_ms"
      ]
    },
    "by": {
      "type": "string",
      "enum": [
        "agent",
        "project",
        "team",
        "pr",
        "task"
      ]
    },
    "from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "totals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "tenantId",
    "kind",
    "by",
    "from",
    "totals"
  ],
  "additionalProperties": false
}
```

See [exit codes](/cli/#exit-codes) for the status the process returns.

Source: https://docs.overlane.app/cli/observe-metrics/index.mdx
