# Logs in Telemetry

> Every call as a step in the trace of its use case, with the attributes it carries and what it never carries.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://ai.docs.sypnia.com/safety/logs-and-telemetry/

For agents: Spans exported via OTLP: Cloud → the project's Sypnia Telemetry automatically; self-hosted → SYPNIA_GATEWAY_OTLP_ENDPOINT (+ headers). Span name gen_ai.<operation> <task>; attributes gen_ai.operation.name, gen_ai.provider.name, gen_ai.request.model, gen_ai.response.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.usage.cached_input_tokens, gen_ai.response.finish_reasons, sypnia.ai.task, sypnia.ai.route_version, sypnia.ai.credits, sypnia.ai.call_id, sypnia.ai.cache, sypnia.case, enduser.id (hashed), time to first token; child spans per attempt. Never message or answer content in spans. Errors become Telemetry problems (provider_unavailable bursts, output_invalid).

Every call is a span: a step with a start, an end and what happened, inside the trace of the request that made it. In Sypnia Cloud the spans go to your project's [Telemetry](https://telemetry.docs.sypnia.com/) with no setup. Self-hosted, set `SYPNIA_GATEWAY_OTLP_ENDPOINT` and they go to Telemetry or any OpenTelemetry tool.

## What a span carries

| Attribute                                                 | Example                                       |
| --------------------------------------------------------- | --------------------------------------------- |
| `gen_ai.operation.name`                                   | `chat`, `embeddings`                          |
| `gen_ai.provider.name`                                    | `openrouter`, `aws.bedrock`                   |
| `gen_ai.request.model`, `gen_ai.response.model`           | the model asked for and the one that answered |
| `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens` | `412`, `38`                                   |
| `gen_ai.usage.cached_input_tokens`                        | `350`                                         |
| `gen_ai.response.finish_reasons`                          | `["stop"]`                                    |
| `sypnia.ai.task`, `sypnia.ai.route_version`               | `allergen-answer`, `12`                       |
| `sypnia.ai.credits`                                       | the credits charged                           |
| `sypnia.ai.time_to_first_token_ms`                        | `420`                                         |
| `sypnia.ai.cache`                                         | `hit`, `miss`                                 |
| `sypnia.ai.call_id`                                       | the id support asks for                       |
| `sypnia.case`                                             | `ask-about-a-product`                         |
| `enduser.id`                                              | the person's id, hashed                       |

Each fallback tried is a child span with its model and why it failed. The span's name is `chat allergen-answer`.

## What it never carries

What was asked and what was answered. A trace shows that a question took 1.2 seconds and cost so much; it never shows the question.

## Problems

Repeated failures become problems in Telemetry like any other: «12 customers got no answer about allergens in the last hour: every model of `allergen-answer` timed out».
