# Send OpenTelemetry data

Send traces and per-minute request summaries from any OpenTelemetry SDK over OTLP/HTTP with the project's DSN key, so any language works without a Sentry SDK and request counts and percentiles are exact.

Replace _key_ with the public key of the project's DSN, _project-number_ with the number at its
end, and _ingest_ with its host (the DSN is `https://key@ingest/project-number`, on the project's
**Setup** tab).

App Monitoring takes OpenTelemetry's OTLP/HTTP next to the Sentry endpoints, with the same key:

| Signal  | Endpoint                                            |
| ------- | --------------------------------------------------- |
| Traces  | `https://ingest/api/project-number/otlp/v1/traces`  |
| Metrics | `https://ingest/api/project-number/otlp/v1/metrics` |

Both take protobuf (`application/x-protobuf`, the exporters' default) and JSON. The key goes in an
`x-sentry-auth: sentry sentry_key=key` header or `Authorization: Bearer key`.

## Configure an exporter

Most OpenTelemetry SDKs read these environment variables:

```sh
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest/api/project-number/otlp
OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer key"
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION=base2_exponential_bucket_histogram
OTEL_SERVICE_NAME=shop
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production,service.version=1.4.2
```

- **Delta temporality** is required for metrics: every point is one interval's count, added up
  across your processes. A cumulative point is refused, and the export answer says which setting
  fixes it.
- **Exponential histograms** make percentiles exact to the histogram's precision; with the
  default explicit buckets they are approximated inside each bucket.
- `deployment.environment.name` and `service.version` become the environment and the release.

## Exact numbers: request-duration metrics

With your SDK's HTTP instrumentation on, each process records every request in the
semantic-convention metric `http.server.request.duration` and sends it once a minute. App
Monitoring adds the processes' summaries into exact per-route numbers (see
[Monitor your app's performance](monitor-your-apps-performance.md)). It reads:

| Metric                         | Becomes                                                                 |
| ------------------------------ | ----------------------------------------------------------------------- |
| `http.server.request.duration` | a route, `http.request.method` + `http.route`; 5xx or `error.type` fail |
| `http.client.request.duration` | an outgoing call, method + `server.address` + `url.template`            |
| `db.client.operation.duration` | a database operation, `db.query.summary`                                |

Other metrics are ignored here; send them to Monitoring's custom metrics instead.

## Traces

Each local root span (a span whose parent is not in the same export, or a server or consumer span)
becomes a transaction, its descendants its spans: a server span is a request named
`GET /api/orders/{id}` from `http.request.method` and `http.route`, an HTTP client span an outgoing
call, a span with `db.system.name` a database statement on the **Queries** tab. They show on the
**Traces** tab and as waterfalls like the Sentry SDK's.

A span exported in an earlier batch than its root is kept and shown in its trace, but not counted
in its route's numbers. If you sample traces, numbers from them are estimated: send the metrics
above for exact ones.

## Related

- [Monitor your app's performance](monitor-your-apps-performance.md)
- [View traces and transactions](view-traces-and-transactions.md)
