> For the complete documentation index, see [llms.txt](https://docs.multitudes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.multitudes.com/integrations/open-telemetry.md).

# Open Telemetry (OTel)

## What is OTel?

OTel is an open-source, vendor-neutral standard for generating, collecting, and exporting telemetry data such as metrics, logs, and traces. Multitudes uses OpenTelemetry to receive your AI tooling usage data. For more on OpenTelemetry, see the [official documentation](https://opentelemetry.io/docs/what-is-opentelemetry/?utm_source=chatgpt.com).

## How it works

### What metrics we can ingest and process&#x20;

We can ingest and process OTel data for:&#x20;

* Claude Code [Team](https://claude.com/pricing/team) and [Individual](https://claude.com/pricing) plans
* Codex

If you're on the Claude Code [API](https://claude.com/pricing#api) or [Enterprise](https://claude.com/pricing/enterprise) plan, head to our docs here: [Claude Code](https://docs.multitudes.com/integrations/claude-code).&#x20;

{% hint style="info" %}
If you'd like to bring in Open Telemetry data from other AI tools besides Claude Code or Codex, let us know at <support@multitudes.com>.
{% endhint %}

### Integration options&#x20;

We can ingest OTel metrics in two different ways:

#### 1. Multitudes-hosted collector

Claude Code and Codex users send metrics directly to the Multitudes Open Telemetry collector running in Multitudes infrastructure. This avoids having to host a collector in your own infrastructure. &#x20;

To do this, follow steps here: [Multitudes-hosted collector](#multitudes-hosted-collector). Or jump to specific instructions for:

* [Claude Code](#for-claude-code)
* [Codex](#for-codex)

#### 2. Self-hosted collector

You either run your own collector or the Multitudes Open Telemetry collector in your infrastructure. The collector ingests metrics from Claude Code and Codex users and forwards them to Multitudes. To do this, follow the steps below: [Self-hosted collector](#self-hosted-collector)

## Multitudes-hosted collector&#x20;

When using the Multitudes-hosted collector, each user sends their telemetry data directly to the Multitudes endpoint. For this, each user needs a configuration file that specifies the endpoint to use and an `Authorization` header.

Apply the following configuration to each user's machine:&#x20;

#### For Claude Code:&#x20;

1. Open the `~/.claude/settings.json` .
2. Add the following lines, using an API key that has been generated (following the instructions below):

```json
"env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "https://integrations.multitudes.co/otel",
    "OTEL_METRIC_EXPORT_INTERVAL": "10000",
    "OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Bearer <replace with your api key>"
},
```

{% hint style="warning" %}
We’re starting new work to measure AI effectiveness. If you’d like to help us out and be beta testers for these upcoming features, include the following in your `~/.claude/settings.json`:

**Tool usage logging**

```
"OTEL_LOG_TOOL_DETAILS": "1"
```

This turns on detailed logging of tool usage in telemetry traces, which includes Bash commands, MCP server and tool names, skill names, prompt length, and the input arguments passed to each tool. This redacts the contents of prompts unless you have specifically enabled that (see next section).

**Bonus: Prompt logging**

```
"OTEL_LOG_USER_PROMPTS": "1"
```

If you like, you can also turn this on to send us the contents of prompts that your organization is using. We do not receive the contents of any attached files unless they are explicitly included in the prompt text.

More about these environment variables in the [Claude Code docs](https://code.claude.com/docs/en/monitoring-usage).

Note that enabling both of these settings is optional and will not change anything in the Multitudes app now. But enabling this data will give us real user data to test new features on and you’ll gain early access to these new features as we build them.
{% endhint %}

{% hint style="info" %}
The `Authorization` header can be an Organization API key if you are provisioning this file via MDM and want to use the same key across multiple users. If you would prefer that each user has their own key, they can create a Personal API key and update their `~/.claude/settings.json` file.
{% endhint %}

{% hint style="info" %}
**AWS Bedrock:** when using Bedrock the `user.email` attribute must be configured manually via the `OTEL_RESOURCE_ATTRIBUTES` environment variable. This is because Bedrock authentication does not automatically provide user email information. Each user will need to add their work email address (or whichever email is associated with their user in Multitudes):&#x20;

```json
"env": {
    ...    
    "OTEL_RESOURCE_ATTRIBUTES": "user.email=developer@company.com"
}
```

&#x20;&#x20;
{% endhint %}

#### For Codex:

1. Open the `~/.codex/config.toml`.
2. Add the following lines:

```toml
[otel]
exporter = { otlp-http = { endpoint = "https://integrations.multitudes.co/otel/v1/logs", protocol = "binary", headers = { "Authorization" = "Bearer <replace with your api key>" } } }
log_user_prompt = false
```

3. Each user should generate a personal API key using the instructions below&#x20;
4. Replace `<replace with your api key>` with your actual API key. Restart any sessions you might have in Claude.

## Self-hosted collector

When using the self-hosted collector, each user sends their telemetry data to a collector run in your infrastructure, from which aggregated metrics are sent to Multitudes.&#x20;

### Running the collector&#x20;

1. Set up the Multitudes OTel Collector. Detailed instructions can be found [here](https://github.com/MultitudesCo/otel-collector).&#x20;
2. Follow the instructions below to generate an Organization API key and run the collector using this key. &#x20;

### Sending from an existing collector

1. If you have an existing collector, update your config to add an exporter that sends to the Multitudes ingestion endpoint. The main sections to configure are in `exporters` , `processors`, and `service`. &#x20;
2. Add a new `otlphttp/multitudes` exporter&#x20;

```yaml
exporters:
  otlphttp/multitudes:
    endpoint: https://integrations.multitudes.co/otel
    encoding: json
    headers:
      Authorization: "Bearer ${env:MULTITUDES_API_KEY}"
    timeout: 30s
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s
```

3. Add the new `otlphttp/multitudes` to your existing metrics and logs pipelines:

```yaml
service:
  pipelines:
    metrics:
      receivers:  [...your existing receivers]
      processors: [...your existing processors]
      exporters:  [...your existing exporters, otlphttp/multitudes]
    logs:
      receivers:  [...your existing receivers]
      processors: [...your existing processors]
      exporters:  [...your existing exporters, otlphttp/multitudes]
```

4. Follow the instructions below to generate an Organization API key and run the collector using this key. &#x20;

### Sending data to the collector&#x20;

Apply the following configuration to each user's machine: &#x20;

```json
{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "http/protobuf",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "<replace with collector endpoint>",
    "OTEL_METRIC_EXPORT_INTERVAL": "10000"
  }
}
```

{% hint style="info" %}
**AWS Bedrock:** when using Bedrock the `user.email` attribute must be configured manually via the `OTEL_RESOURCE_ATTRIBUTES` environment variable. This is because Bedrock authentication does not automatically provide user email information. Each user will need to add their work email address (or whichever email is associated with their user in Multitudes):&#x20;

```json
"env": {
    ...    
    "OTEL_RESOURCE_ATTRIBUTES": "user.email=developer@company.com"
}
```

{% endhint %}

## Checking data ingestion status

Once you are sending data to Multitudes, either directly or via the self-hosted option, you can check the ingestion status in the Multitudes app, Open the [OpenTelemetry integration modal](https://app.multitudes.co/team-settings/integrations?pill=true\&integration=otel) to check whether your data is coming through.

<figure><img src="/files/WEJJcL3iXWX01uWVzGXk" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/uUZcFgXrunQyJmht99x3" alt="" width="523"><figcaption></figcaption></figure>

Once data is being received successfully, your Claude usage metrics will appear in Multitudes after our batch processing pipeline runs. Our pipeline runs daily, so in most cases you should expect to see metrics populate in the Multitudes App within up to one day of sending data.

## Generating an API Key

{% hint style="info" %}
All users can create personal API keys for sending OTel metrics directly to Multitudes. Owners can create organization API keys for running a central OTel collector that then forwards aggregated metrics to Multitudes&#x20;
{% endhint %}

1. From the [Settings > API Keys](https://app.multitudes.co/team-settings/api-keys) page, click "+ Generate New Key" on the top right corner of the page. This will pop-up a modal.

<figure><img src="/files/HMAwQXqhovQxUwWcfI4M" alt=""><figcaption></figcaption></figure>

2. In the modal, select your key type. This depends on your organization setup.&#x20;

{% hint style="info" %}
If you're running a self-hosted OTel collector or have only a single API key for everyone in the organization, then you can select the Organization key type. If you'd like team members to have separate API keys, then select Personal.
{% endhint %}

3. Select "Write" for Open Telemetry. Once this is done, click "Create key".

<figure><img src="/files/ymZ8XLNETsxtAOVlftoJ" alt=""><figcaption></figcaption></figure>

4. After the key has been generated, copy it for use as the Bearer token in your OTel settings or when running your Multitudes OTel collector. The full key will only be shown once.&#x20;

<figure><img src="/files/ZwndVvoUP7LAy3LcBQpL" alt=""><figcaption></figcaption></figure>
