---
title: "OpenTelemetry: your app's metrics and traces, the while.sh docs"
url: https://while.sh/en/docs/building-blocks/opentelemetry/
updated: 2026-11-09
---

# OpenTelemetry

An OpenTelemetry endpoint for the metrics and traces of your app itself, which join what while already measures.

> You, to your agent: Set up OpenTelemetry to track the time of database queries.

## What your app receives

Your app receives these environment variables at every deployment:

| Variable | What it holds |
|---|---|
| `OTEL_EXPORTER_OTLP_ENDPOINT` | The OTLP/HTTP endpoint, reachable without opening outbound traffic. |
| `OTEL_SERVICE_NAME` | The name the service appears under. |

## When to use it

For the app's own metrics and traces, with an OpenTelemetry SDK.

## How it works

An OTLP/HTTP endpoint (`OTEL_EXPORTER_OTLP_ENDPOINT`, reachable without opening `egress`) receives the app's logs and metrics, which join while's in the organization's space (`get_logs` and `observe_app` tools). Its traces are kept 30 days and are read with `observe_app` `{ view: "traces" }`.

## What to know

Traces are read by service (`OTEL_SERVICE_NAME`, the project's name by default) or by id. Of a trace that crosses several projects, only the environment's part is returned.

Only OTLP/HTTP is accepted, not gRPC, with 4 MiB per send. Metrics arrive in protobuf (gzip, deflate or zstd). A metric with a name reserved for the platform (cnpg_, kube_, container_, while_, node_, envoy_, vm_…, and up), or a __name__ attribute, is filed under appli_…, and the response says so (renommees).

## Your agent's MCP tools

Your agent handles it with the `get_logs` and `observe_app` tools.
