This page covers two complementary paths: Cloudflare AI Gateway’s own OTLP export, and app-side OpenInference tracing for OpenAI-compatible requests that route through Cloudflare. Neither path requires a Cloudflare-specific OpenInference instrumentor.
Prerequisites
- A Cloudflare AI Gateway
- Python 3.9+ if you want app-side OpenInference tracing
- An Arize AX account (sign up)
- Your Arize AX Space ID and API Key
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key.
Option 1: export gateway spans from Cloudflare
In the Cloudflare dashboard:- Open your AI Gateway.
- Go to Settings.
- Add an OpenTelemetry exporter.
- Set the exporter URL to the Arize AX OTLP/HTTP traces endpoint:
Cloudflare AI Gateway lets you attach custom metadata to requests with the
cf-aig-metadata header. Those values are exported as span attributes, so they are useful for user, team, environment, or tenant filters in Arize AX. Do not include secrets or sensitive personal data.Send a gateway request
Send traffic through the gateway as usual. For example, with the OpenAI-compatible route:Option 2: trace OpenAI-compatible app calls
If your application uses the OpenAI SDK against Cloudflare AI Gateway’s/compat endpoint, use the OpenInference OpenAI instrumentor. This captures the application-side request and response, while the Cloudflare exporter captures gateway-side spans.
Install the client-side packages:
/compat route. Use the provider API key and provider-prefixed model name that match the model you route through the gateway.
Verify in Arize
- Open your Arize AX space.
- Look for gateway spans within ~30 seconds.
- If you do not set an OpenInference project resource attribute through a collector, the spans may appear in the default project.
Check from the skill, CLI, or SDK
Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
What Arize captures
Cloudflare AI Gateway exports spans using OpenTelemetry GenAI semantic conventions. Arize AX can ingest those spans and render the model request alongside attributes such as:- model and provider
- input and output token counts
- prompt and completion JSON
- estimated cost
- custom metadata from
cf-aig-metadata - trace context, if you pass Cloudflare’s trace context headers
Optional: add a project name with an OpenTelemetry Collector
Arize AX uses theopeninference.project.name resource attribute to organize spans into projects. Cloudflare AI Gateway’s direct exporter focuses on endpoint, headers, and content type. If you want these spans in a named AX project instead of the default project, send the gateway export to an OpenTelemetry Collector first and add a resource processor:
space_id and api_key headers.
Troubleshooting
- No traces in Arize. Confirm the exporter URL is
https://otlp.arize.com/v1/traces, the content type is protobuf, and both Arize headers are present. - Traces appear in the default project. Add
openinference.project.namewith an OpenTelemetry Collector resource processor. - Missing application spans. Cloudflare AI Gateway traces the gateway request. Use the OpenInference client-side path if you also need prompt, response, chain, tool, retriever, or framework spans from your application.