Skip to main content

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.

Recommended: install OBI for one-step setup

The simplest way to feed AI Center is to install Coralogix eBPF auto-instrumentation (OBI) 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 for verified libraries that emit OTEL GenAI semconv.
  • No library covers your provider or language → instrument manually. See Span attribute inventory 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. Copy-pasteable Python, Java, .NET, and Go scripts that send GenAI spans to Coralogix.

Let your coding agents do this​

Recommended

Easiest way through this page: hand it to your coding agent. Copy this prompt in:

Read https://coralogix.com/docs/ai-center, install the coralogix-ai-center skill
(npx skills add coralogix/cx-cli --skill coralogix-ai-center), then run it to
instrument this application and verify the data in Coralogix AI Center.

The coralogix-ai-center skill figures out how your app calls the LLM, wires up the right instrumentation, runs a real request through your app, and checks the spans actually land in AI Center, fixing things and re-running until they do. It only asks you for what it can't get on its own, like a Send-Your-Data key.

What you need​

The skill above works these out for you. You only need this list for the manual setup below.

AI Center processes only trace data, not logs, and retrieves it exclusively from your S3 archive. 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.

Manual setup​

This is the manual alternative to the skill above, in case you'd rather do it yourself or don't have a coding agent handy.

Export traces from your application to a local OpenTelemetry Collector running the Coralogix Exporter. 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):

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

exporters:
coralogix:
domain: "eu2.coralogix.com"
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.

Step 2: Set application environment variables​

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 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 for the full list of gen_ai.* attributes AI Center consumes.

See Compatibility matrix 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.

Truncated attribute values can break span parsing​

AI Center stores several GenAI attributes as JSON-encoded strings, most importantly gen_ai.input.messages and gen_ai.output.messages. If your OpenTelemetry SDK is configured to cap attribute-value length, these payloads are cut off mid-JSON which can cause some fields to fail parsing.

The cap comes from either of these standard OpenTelemetry SDK environment variables, both of which default to no limit:

OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT # applies to all attributes
OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT # applies to span attributes

Fix: Unset both variables so GenAI attribute values are exported in full. If your environment requires a cap, set it high enough to hold your largest message payload.

Missing message content​

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

# OTel Python contrib
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

# OpenLLMetry / Traceloop
export TRACELOOP_TRACE_CONTENT=true

Verifying spans with 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.

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

OpenAIInstrumentor().instrument() # 2. Then instrument
# 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​

MistakeFix
gen_ai.input.messages set as object, not stringMust be a string containing JSON, not a native object
Missing role field in messagesEvery message must have a role field
Using gen_ai.model instead of gen_ai.request.modelCorrect: gen_ai.request.model (request) or gen_ai.response.model (response)

Further reading​

Next steps​

Start sending spans with Code examples. Copy-pasteable Python, Java, .NET, and Go scripts for the most common providers.

Last updated on
On this page
Was this page helpful?