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

# Monitoring traces

> Subscribe to monitoring.traces webhook events. Interpret Voiceflow turn, model-call and tool-call spans and forward their OTLP JSON to your monitoring system.

`monitoring.traces` delivers performance spans from an agent's recorded turns to the project's [Monitoring webhook](/docs/api-reference/webhooks/session-lifecycle). Each message contains OpenTelemetry Protocol (OTLP) JSON inside the Voiceflow envelope. This event describes turn execution; it does not establish that a session ended or its [evaluations finished](/docs/api-reference/webhooks/evaluation-events#choose-an-event).

## Subscribe to traces

Use the project's **Settings → Monitoring → Monitoring webhook**. Configure your receiver URL and signing secret through the [webhook setup](/docs/api-reference/webhooks/session-lifecycle#configuring-your-webhook), then select **Listen for specific events → Health and performance → Traces**. Wait for **Saved**.

Monitoring webhook event selector with Health and performance and Traces selected — Choose Traces under Health and performance to opt this project endpoint in to monitoring.traces.

**Listen for all events** excludes `monitoring.traces`. Before monitoring is enabled for a project, the page is named **Settings → Webhooks**, and **Traces** is absent. Selecting lifecycle or evaluation events does not subscribe the endpoint to traces.

## Envelope and OTLP structure

| Field | Contract |
| --- | --- |
| `type` | The literal string `monitoring.traces`. |
| `data` | An OTLP JSON `ExportTraceServiceRequest` with `resourceSpans`, an array of resource groups. |
| `time` | Dispatch time as a number of Unix milliseconds. This is separate from the spans' execution timestamps. |
| `resource` | The project endpoint identifier, `project-{projectID}`. |

Within each `data.resourceSpans[]` group:

| Field | Meaning |
| --- | --- |
| `resource.attributes` | Typed key/value attributes identifying Voiceflow, the project and the Environment. |
| `scopeSpans[].scope.name` | Instrumentation scope, `voiceflow`. |
| `scopeSpans[].spans` | The spans produced from the recorded turn, model-call and tool-call outcomes. |
| `schemaUrl` and `scopeSpans[].schemaUrl` | Semantic-convention schema, currently `https://opentelemetry.io/schemas/1.43.0`. |

OTLP values keep their typed wrappers: `stringValue`, `boolValue` or `intValue`. Integer values and nanosecond timestamps are decimal **strings**, not JSON numbers. Trace IDs are 32 hexadecimal characters; span IDs are 16 hexadecimal characters. See the [OTLP specification](https://opentelemetry.io/docs/specs/otlp/) for the transport format.

### Spans and status

| Span | Name and kind | What it describes |
| --- | --- | --- |
| Turn | `voiceflow.turn`, `kind: 2` (server) | Turn duration, request type, time to first response, degraded state and available error information. |
| Model call | `chat {model}` or `chat`, `kind: 3` (client) | A recorded model-call result or error, provider/model, latency and available input/output token counts. |
| Tool call | `execute_tool {toolName}` or a tool type/ID fallback, `kind: 1` (internal) | A recorded tool result, latency, tool identifiers and available error information. |

Model and tool spans use `parentSpanId` to reference the turn span. `traceId` groups spans for **one turn**. Use the `gen_ai.conversation.id` span attribute to correlate turns from the same transcript; do not treat `traceId` as a conversation ID.

Every emitted span has `startTimeUnixNano`, `endTimeUnixNano`, `attributes`, `events` and `status`. `status.code: 0` means unset; `2` means error. A degraded turn can still have code `0`, so inspect `voiceflow.turn.degraded` separately. A model fallback can add the span event `voiceflow.llm.fallback`.

### Attributes

Absent source values are omitted rather than replaced with empty strings.

| Location | Attributes |
| --- | --- |
| Resource | `service.name: voiceflow`, `voiceflow.project.id`; project name, Environment ID/name/alias and `service.version` when resolved. `service.version` is the release name or `draft` for a recognized draft version. |
| Every span | `gen_ai.conversation.id` is the transcript ID; `voiceflow.turn.id` is the turn ID. |
| Turn | `voiceflow.request.type`, `voiceflow.event.name`, `voiceflow.event.matched`, `voiceflow.turn.degraded`, `voiceflow.turn.time_to_first_response_ms`. |
| Model call | `gen_ai.operation.name: chat`, `gen_ai.provider.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`. |
| Tool call | `gen_ai.operation.name: execute_tool`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `voiceflow.tool.type`, `voiceflow.tool.id`. |
| Errors | `error.type` and `voiceflow.error.category` when recorded for that outcome. |

The mapper exports selected performance metadata rather than prompts, customer messages, tool arguments or response bodies. Project, Environment and tool names can appear in attributes; account for those names when choosing who can read your monitoring destination.

## Example turn payload

This illustrative event contains one successful text turn lasting 1,500 milliseconds, with a 400-millisecond time to first response. It contains no model-call or tool-call spans. IDs and names are fictional.

```json
{
  "type": "monitoring.traces",
  "data": {
    "resourceSpans": [
      {
        "resource": {
          "attributes": [
            {
              "key": "service.name",
              "value": {
                "stringValue": "voiceflow"
              }
            },
            {
              "key": "voiceflow.project.id",
              "value": {
                "stringValue": "project-example"
              }
            },
            {
              "key": "voiceflow.project.name",
              "value": {
                "stringValue": "Order support"
              }
            },
            {
              "key": "voiceflow.environment.id",
              "value": {
                "stringValue": "environment-example"
              }
            },
            {
              "key": "voiceflow.environment.name",
              "value": {
                "stringValue": "Main"
              }
            },
            {
              "key": "deployment.environment.name",
              "value": {
                "stringValue": "main"
              }
            },
            {
              "key": "service.version",
              "value": {
                "stringValue": "V2.00"
              }
            }
          ]
        },
        "scopeSpans": [
          {
            "scope": {
              "name": "voiceflow"
            },
            "spans": [
              {
                "traceId": "4c9d7918e21a9d73ed23a441bf065cbe",
                "spanId": "1ca490a8bcc2d5fd",
                "name": "voiceflow.turn",
                "kind": 2,
                "startTimeUnixNano": "1796320800000000000",
                "endTimeUnixNano": "1796320801500000000",
                "attributes": [
                  {
                    "key": "voiceflow.request.type",
                    "value": {
                      "stringValue": "text"
                    }
                  },
                  {
                    "key": "voiceflow.turn.degraded",
                    "value": {
                      "boolValue": false
                    }
                  },
                  {
                    "key": "voiceflow.turn.time_to_first_response_ms",
                    "value": {
                      "intValue": "400"
                    }
                  },
                  {
                    "key": "gen_ai.conversation.id",
                    "value": {
                      "stringValue": "transcript-example"
                    }
                  },
                  {
                    "key": "voiceflow.turn.id",
                    "value": {
                      "stringValue": "turn-example"
                    }
                  }
                ],
                "events": [],
                "status": {
                  "code": 0
                }
              }
            ],
            "schemaUrl": "https://opentelemetry.io/schemas/1.43.0"
          }
        ],
        "schemaUrl": "https://opentelemetry.io/schemas/1.43.0"
      }
    ]
  },
  "time": 1796320801600,
  "resource": "project-project-example"
}
```

## Receive and forward traces

### 1. Verify the Voiceflow request

Use the endpoint's signing secret to [verify the original body](/docs/api-reference/webhooks/overview#receiving-events), then parse JSON and route on `type`. Authenticate the webhook before trusting its project or OTLP attributes.

### 2. Forward the OTLP data

Send the event's **`data` object** as JSON to your configured OTLP/HTTP trace receiver, for example `https://collector.example.com/v1/traces`. Replace that illustrative URL with your destination’s configured trace-ingestion URL and use its authentication and TLS requirements. The complete Voiceflow envelope is not an OTLP request; an OTLP receiver should not receive its outer `type`, `time` or `resource` fields.

```javascript
// After verifying the Voiceflow signature and parsing the request body:
if (event.type === 'monitoring.traces') {
  const response = await fetch(process.env.OTLP_TRACES_URL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(event.data)
  });
  if (!response.ok) throw new Error(`OTLP receiver returned ${response.status}`);
}
```

This fragment shows payload selection only. Your receiver must supply signature verification, destination authentication and durable processing appropriate to its webhook responses.

### 3. Check correlation and missing data

Run a conversation in the subscribed project, then look for `service.name: voiceflow`, the matching `voiceflow.project.id` and `gen_ai.conversation.id` in your destination. Inspect each turn's spans and errors. This event is emitted from recorded trace messages, not only when a session ends.

If nothing arrives, confirm the event is explicitly selected, the receiver verifies and accepts the webhook, and the destination accepts the inner OTLP JSON. A message with no supported outcome metadata produces no spans. Older recorded outcomes without a turn ID or timestamp are skipped.

### Delivery boundaries

Telemetry mapping and submission are best effort. A failed analytics lookup, mapping or webhook submission is not retried by that analytics consumer; webhook delivery is a subsequent stage. Do not use the absence of a trace event as evidence that no turn ran, or this feed as a complete transcript archive.

Do not assume arrival order. Preserve deterministic `traceId`/`spanId` values when forwarding, and make your receiver tolerant of repeated deliveries. Use [session events](/docs/api-reference/webhooks/session-lifecycle#session-events) for conversation boundaries and [evaluation events](/docs/api-reference/webhooks/evaluation-events) for scoring completion.
