# OpenTelemetry integration for AI Center

OpenTelemetry (OTEL) GenAI semantic conventions define a standardized set of span attributes for observing generative AI applications. Instead of each AI provider or instrumentation library inventing its own telemetry format, these conventions establish a common schema for recording LLM requests, responses, token usage, and tool calls.

By adopting OTEL GenAI conventions, you get:

- **Vendor-neutral observability** — the same span attributes work regardless of whether you use OpenAI, Anthropic, Google Vertex AI, or another provider.
- **Automatic correlation** — traces link prompts to completions to downstream tool calls, giving you end-to-end visibility into AI agent workflows.
- **Interoperability** — any OTEL-compatible collector, backend, or visualization tool can process GenAI spans.

Coralogix AI Center natively ingests and renders GenAI spans that follow the [OpenTelemetry GenAI semantic conventions](https://coralogix.com/docs/user-guides/ai/otel-integration/span-attributes/index.md).

Recommended: install OBI for one-step setup

The simplest way to feed AI Center is to install **[Coralogix eBPF auto-instrumentation (OBI)](https://coralogix.com/docs/opentelemetry/instrumentation-options/ebpf-auto-instrumentation/overview/index.md)** on the host running your AI application. One install captures AI/LLM traffic from OpenAI, Google Gemini (AI Studio and Vertex AI), AWS Bedrock, Qwen (DashScope), MCP over JSON-RPC, embedding providers, and rerank providers — and brings every other OBI capability (distributed tracing, database observability, encrypted-traffic visibility, cloud metadata decoration) along on the same install. No code changes, no SDKs, no per-language agents.

## Instrument with OpenTelemetry GenAI semconv

Prefer to instrument your application directly with OpenTelemetry instead of using OBI? AI Center supports **any** instrumentation that emits `gen_ai.*` attributes per the spec — whether you create spans manually, use an OpenTelemetry contrib instrumentation, or use a community library like OpenLLMetry.

Pick the path that fits your stack:

- **A library already covers your provider** → use it. See [Compatibility matrix](https://coralogix.com/docs/user-guides/ai/otel-integration/providers/index.md) for verified libraries that emit OTEL GenAI semconv.
- **No library covers your provider or language** → instrument manually. See [Span attribute inventory](https://coralogix.com/docs/user-guides/ai/otel-integration/span-attributes/index.md) for the attributes AI Center expects.

The libraries surfaced in this doc set are third-party open-source projects, not Coralogix products. Coralogix does not own, maintain, or endorse them. AI Center accepts spans from any of them — and from any custom instrumentation that follows the spec.

Ready to get started?

Jump to a working setup with [Code examples](https://coralogix.com/docs/user-guides/ai/otel-integration/code-examples/index.md) — copy-pasteable Python, Java, .NET, and Go scripts that send GenAI spans to Coralogix.

## What you need

- An OpenTelemetry-instrumented application — see [Compatibility matrix](https://coralogix.com/docs/user-guides/ai/otel-integration/providers/index.md) for the library that fits your stack.
- An [OpenTelemetry Collector](https://coralogix.com/docs/opentelemetry/configuration-options/install-opentelemetry-on-an-ec2-instance/index.md) with the [Coralogix Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/coralogixexporter) configured (recommended), **or** a Coralogix [Send-Your-Data API key](https://coralogix.com/docs/user-guides/account-management/api-keys/api-keys/index.md) for direct OTLP export.

AI Center processes **only trace data**, not logs, and retrieves it **exclusively from your [S3 archive](https://coralogix.com/docs/user-guides/data-flow/s3-archive/connect-s3-archive/index.md)**. Data stored in Frequent Search will be ignored. Instrument your observability data as traces and route it to archive storage.

For the complete list of attributes AI Center consumes, see [Span attribute inventory](https://coralogix.com/docs/user-guides/ai/otel-integration/span-attributes/index.md).

## Set up auto-instrumentation

### Step 1: Deploy an OpenTelemetry Collector (recommended)

Export traces from your application to a local [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) running the [Coralogix Exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/coralogixexporter). The collector handles authentication, batching, and retry — keeping credentials out of your application code.

Select your Coralogix region using the domain selector at the top of this page. The domain in the collector config below updates to match the region you pick.

Minimal collector config (`otel-collector-config.yaml`):

```yaml
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: "0.0.0.0:4317"

exporters:
  coralogix:
    domain: "[[DOMAIN_VALUE]]"
    private_key: "${CORALOGIX_PRIVATE_KEY}"
    application_name: "my-genai-app"
    subsystem_name: "my-service"
    application_name_attributes:
      - "cx.application.name"
    subsystem_name_attributes:
      - "cx.subsystem.name"
    timeout: 30s

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [coralogix]
```

Preserve application and subsystem names set by your app

When `application_name_attributes` and `subsystem_name_attributes` are configured, the collector resolves the application and subsystem from the resource attributes your app sets (for example, `cx.application.name` and `cx.subsystem.name`). If neither attribute is found, it falls back to the static `application_name` and `subsystem_name` values. Without these settings, the collector uses only the static fallback and ignores the values your application sends.

Alternative: export directly to Coralogix (no collector)

If you prefer to skip the collector, your application can export traces directly to the Coralogix OTLP endpoint. Use the domain selector at the top of this page to set your region — the endpoint below updates automatically.

```bash
export OTEL_EXPORTER_OTLP_ENDPOINT="https://ingress.[[DOMAIN_VALUE]]:443"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <your-api-key>"
export OTEL_RESOURCE_ATTRIBUTES="cx.application.name=my-app,cx.subsystem.name=my-subsystem"
```

### Step 2: Set application environment variables

```bash
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_EXPORTER_OTLP_INSECURE="true"
export OTEL_SERVICE_NAME="my-ai-service"
export OTEL_RESOURCE_ATTRIBUTES="cx.application.name=my-app,cx.subsystem.name=my-subsystem"
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental
```

### Step 3: Install auto-instrumentation

The setup varies by language and provider. See [Code examples](https://coralogix.com/docs/user-guides/ai/otel-integration/code-examples/index.md) for complete, copy-paste-ready scripts for OpenAI Agents, Anthropic Claude, AWS Bedrock, and more.

If your provider or language lacks an open-source instrumentation library, you can manually create GenAI spans. See [Span attribute inventory](https://coralogix.com/docs/user-guides/ai/otel-integration/span-attributes/index.md) for the full list of `gen_ai.*` attributes AI Center consumes.

See [Compatibility matrix](https://coralogix.com/docs/user-guides/ai/otel-integration/providers/index.md) for the full list of verified instrumentation libraries.

## Troubleshooting

### Spans not appearing in AI Center

Coralogix AI Center filters for GenAI spans using `gen_ai.provider.name` or `gen_ai.input.messages`. If neither attribute is set, the span will not appear.

### Missing message content

Many libraries **do not capture message content by default**. Enable it:

```bash
# OTel Python contrib
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

# OpenLLMetry / Traceloop
export TRACELOOP_TRACE_CONTENT=true
```

### Verifying spans with DataPrime

```dataprime
source spans
| filter tags['gen_ai.provider.name']:string != null
| select $m.traceID,
         tags['gen_ai.provider.name']:string,
         tags['gen_ai.request.model']:string,
         tags['gen_ai.usage.input_tokens']:string,
         tags['gen_ai.usage.output_tokens']:string
| limit 10
```

### Instrumentation not capturing spans

The `instrument()` call must come **after** importing the LLM provider library. If you call `instrument()` before importing the provider SDK, the instrumentor cannot patch the library and no spans are emitted.

```python
# Correct order
import openai                          # 1. Import provider first
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor

OpenAIInstrumentor().instrument()      # 2. Then instrument
```

```python
# Wrong order — no spans will be captured
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor

OpenAIInstrumentor().instrument()      # Instrument runs before provider is imported
import openai                          # Too late — library was not patched
```

### Common attribute mistakes

| Mistake                                                | Fix                                                                             |
| ------------------------------------------------------ | ------------------------------------------------------------------------------- |
| `gen_ai.input.messages` set as object, not string      | Must be a **string** containing JSON, not a native object                       |
| Missing `role` field in messages                       | Every message must have a `role` field                                          |
| Using `gen_ai.model` instead of `gen_ai.request.model` | Correct: `gen_ai.request.model` (request) or `gen_ai.response.model` (response) |

## Further reading

- [OpenTelemetry GenAI Semantic Conventions spec](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
- [OTel Python Contrib GenAI instrumentors](https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai)
- [OpenLLMetry by Traceloop](https://github.com/traceloop/openllmetry)
- [Microsoft.Extensions.AI documentation](https://learn.microsoft.com/en-us/dotnet/ai/microsoft-extensions-ai)

## Next steps

Start sending spans with [Code examples](https://coralogix.com/docs/user-guides/ai/otel-integration/code-examples/index.md) — copy-pasteable Python, Java, .NET, and Go scripts for the most common providers.
