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

# Telemetry Export (OTEL)

> Export OpenTelemetry metrics from Droid to your own OTLP-compatible collector for full visibility in your existing observability stack.

Droid can export OpenTelemetry (OTEL) metrics to your own OTLP-compatible collector, giving you full visibility into Droid activity within your existing observability stack. Metrics are sent to both Factory's collector and yours in the same export cycle -- if your collector is unreachable, Factory's own export is not affected.

***

## Configuration

Set these environment variables before launching Droid:

```bash theme={null}
export OTEL_TELEMETRY_ENDPOINT="https://your-collector.example.com:4318"
export OTEL_TELEMETRY_HEADERS="Authorization=Bearer <your-token>"
```

| Variable                  | Required | Description                                                                                                          |
| :------------------------ | :------- | :------------------------------------------------------------------------------------------------------------------- |
| `OTEL_TELEMETRY_ENDPOINT` | Yes      | Base URL of your OTLP HTTP collector. Metrics are sent to `{endpoint}/v1/metrics`.                                   |
| `OTEL_TELEMETRY_HEADERS`  | No       | Comma-separated `key=value` pairs sent as HTTP headers on every export. Values may contain `=` (e.g. base64 tokens). |

***

## How it works

* When `OTEL_TELEMETRY_ENDPOINT` is set, metrics are sent to your endpoint in the same export cycle via a fan-out exporter -- no extra timers, no duplication of metric readers.
* Failures to your collector do not affect Factory's own export. Each endpoint is isolated.
* Metrics use **delta temporality** -- each export contains only new values since the last flush (60-second intervals).

***

## Exported metrics

All metrics use the `droid.*` namespace.

| Metric                            | Type      | Description                     |
| :-------------------------------- | :-------- | :------------------------------ |
| `droid.code.files_modified`       | Counter   | Files modified during a session |
| `droid.code.files_read`           | Counter   | Files read during a session     |
| `droid.code.lines_modified`       | Counter   | Lines of code modified          |
| `droid.git.commits`               | Counter   | Commits created                 |
| `droid.git.pull_requests`         | Counter   | Pull requests created           |
| `droid.tool.invocations`          | Counter   | Tool invocations                |
| `droid.tool.execution_time`       | Histogram | Tool execution duration (ms)    |
| `droid.mcp.tool_invocations`      | Counter   | MCP tool invocations            |
| `droid.skill.invocations`         | Counter   | Skill invocations               |
| `droid.hook.invocations`          | Counter   | Hook invocations                |
| `droid.slash_command.invocations` | Counter   | Slash command invocations       |
| `droid.auth.login_success`        | Counter   | Successful logins               |
| `droid.repo.metadata`             | Gauge     | Repository metadata snapshot    |

***

## Common attributes

Every data point includes these attributes automatically:

| Attribute         | Description              |
| :---------------- | :----------------------- |
| `user.id`         | Authenticated user ID    |
| `organization.id` | Organization ID          |
| `session.id`      | Current Droid session ID |

Tool-specific attributes (`tool.name`, `mcp.server`, `skill.name`, etc.) are included where applicable. Resource attributes include `service.name` (`cli`) and `service.version`.

***

## Example configurations

<AccordionGroup>
  <Accordion title="Generic OTEL Collector / Grafana Alloy">
    ```bash theme={null}
    export OTEL_TELEMETRY_ENDPOINT="https://collector.example.com:4318"
    ```
  </Accordion>

  <Accordion title="Datadog (via Agent OTLP ingestion)">
    ```bash theme={null}
    export OTEL_TELEMETRY_ENDPOINT="http://localhost:4318"
    ```
  </Accordion>

  <Accordion title="Datadog (direct OTLP intake)">
    ```bash theme={null}
    export OTEL_TELEMETRY_ENDPOINT="https://otlp.datadoghq.com"
    export OTEL_TELEMETRY_HEADERS="dd-api-key=<your-datadog-api-key>"
    ```
  </Accordion>

  <Accordion title="New Relic">
    ```bash theme={null}
    export OTEL_TELEMETRY_ENDPOINT="https://otlp.nr-data.net:4318"
    export OTEL_TELEMETRY_HEADERS="api-key=<your-new-relic-license-key>"
    ```
  </Accordion>

  <Accordion title="Honeycomb">
    ```bash theme={null}
    export OTEL_TELEMETRY_ENDPOINT="https://api.honeycomb.io"
    export OTEL_TELEMETRY_HEADERS="x-honeycomb-team=<your-api-key>,x-honeycomb-dataset=droid-metrics"
    ```
  </Accordion>
</AccordionGroup>

***

## Troubleshooting

* Verify your collector accepts OTLP HTTP on the `/v1/metrics` path.
* Confirm `OTEL_TELEMETRY_HEADERS` includes valid auth credentials.
* Ensure network connectivity from the machine running Droid to your collector.
