---
title: luna traces
description: Read an environment's traces, the spans of its calls with how long each took, filtered by type, handler, errors or duration.
related:
  - /observe/follow-traces
  - /cli/logs
---

`luna traces` prints the spans of an environment's calls: where each call went and how long it took.

```bash
luna traces --errors
```

## Reference

```bash
luna traces [OPTIONS] [TYPE]
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `[TYPE]` | text | Every type | Prints only the spans of this luna type. |
| `--handler <HANDLER>` | text | Every handler | Prints only the spans of this handler. |
| `--trace <TRACE>` | text | None | Prints one whole trace, whenever it happened. |
| `--errors` | flag | Off | Prints only calls that failed. |
| `--min-ms <MIN_MS>` | number | `0` | Prints only calls that took at least this many milliseconds. |
| `--since <SINCE>` | moment | `1h` | Starts at this [moment](/cli#moments). |
| `--until <UNTIL>` | moment | Now | Ends at this moment. |
| `--limit <LIMIT>` | number | `100` | The most spans to print. |
| `--json` | flag | Off | Prints each span as Luna sent it, one JSON object a line. |
| `--dir <DIR>` | path | `.` | The app's folder. Its env file names the project and environment. |
| `--env <ENV>` | text | `LUNA_ENV`, then `production` | The environment. |
| `--project <PROJECT>` | text | `LUNA_PROJECT` | The project, by name or as `organisation/project`. |
| `--tenant <TENANT>` | text | The environment's own | A tenant added to the environment, by name. |
| `--token <TOKEN>` | text | `LUNA_TOKEN`, then your login | An API token or account key to act with. |

## Good to know

- Each line has the span's start time, its trace id, how long it took in milliseconds and its name. A span that failed ends with `FAILED`.
- With `--trace`, `--since` is ignored, so an old trace is found as well.
- Pass a trace id to [`luna logs --trace`](/cli/logs) to read the log lines of the same calls.

## Examples

### Read the slow calls of one handler

```bash
luna traces List --handler add --min-ms 500
```

### Read one whole trace

```bash
luna traces --trace <TRACE_ID>
```

### Read the failed calls of the last day

```bash
luna traces --errors --since 24h
```
