# OpenTelemetry (OTel)

Receive logs from any OpenTelemetry exporter.

### Add an OTLP source

#### 1. Open the Add Source dialog

From Sources, click Add Source and select OTLP.

#### 2. Configure the source

Give the source a unique name. By default, incoming telemetry is mapped to streams using two OTel resource attributes:

| Field                 | Notes                                                                                  |
| --------------------- | -------------------------------------------------------------------------------------- |
| Stream Type Attribute | OTel resource attribute mapped to `ct.stream.type`. Defaults to `service.name`.        |
| Stream Name Attribute | OTel resource attribute mapped to `ct.stream.name`. Defaults to `service.instance.id`. |

For most setups the defaults work as long as your exporter sets `service.name` and `service.instance.id` on the resource. The `ct.source.type` and `ct.source.id` fields are always set automatically.

For advanced mappings (e.g. computing stream type/name from different attributes), expand **Custom log statements** to provide [OTTL](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/README.md) transforms that run in the `resource` context and replace the simple mappings above. This is rarely needed.

#### 3. Create

Click Create. Dstl8 generates an OTLP/HTTP endpoint and a bearer token.

#### 4. Configure your exporter

| Field              | Notes                                                                                                                           |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| OTLP/HTTP Endpoint | Base URL for your exporter, e.g. `https://<org_id>.app.dstl8.ai/src-<id>`. The exporter POSTs to `/v1/logs`under this base URL. |
| Bearer Token       | Include in the `Authorization` header of every request.                                                                         |

Example OTel collector config:

```yaml
exporters:
  otlphttp:
    endpoint: https://<org_id>.app.dstl8.ai/src-<id>
    headers:
      Authorization: "Bearer <your-token>"
```

### After creating

The source appears in the list as Pending with 0 streams. Once your exporter starts sending telemetry, streams are detected from the configured attributes and the source transitions to Healthy. Each stream is listed with its inferred Stream Type (e.g. `checkout-service`, `payment-api`, etc..).

### Assign streams to workspaces

Streams need to be assigned to a workspace to be accessible. Open the source's actions menu (gear icon) and select Assign Streams, then check the streams you want the Default workspace (or any other workspace) to receive and Save.

See Assigning streams to workspaces for details.

### Tips

* Use `service.name` to group related instances under one Stream Type, and `service.instance.id` (pod name, hostname, container ID) to give each a unique Stream Name.
* Add a separate OTLP source per environment rather than sharing one endpoint across staging and production, so streams don't collide.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.controltheory.com/controltheory-documentation/dstl8-docs/sources/opentelemetry-otel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
