OpenTelemetry Quick Start

Monitor custom AI agents and multi-framework agentic applications with Fiddler using OpenTelemetry's native instrumentation.

What You'll Learn

In this guide, you'll learn how to:

  • Set up OpenTelemetry tracing for custom agent frameworks

  • Configure Fiddler as your OTLP endpoint with proper authentication

  • Map agent attributes to Fiddler's semantic conventions

  • Create instrumented LLM and tool spans with required attributes

  • Verify traces in the Fiddler dashboard

Time to complete: ~10-15 minutes

When to Use OpenTelemetry Integration

This guide is for advanced users and specific scenarios:

  • Multi-framework environments requiring unified observability across different agent frameworks

  • Custom agentic frameworks without dedicated Fiddler SDK support

  • Advanced control over instrumentation and attribute mapping

When to Use Fiddler SDKs Instead:

SDKs provide automatic instrumentation and require significantly less code. Use OpenTelemetry when SDKs don't fit your use case.

Prerequisites

Before you begin, ensure you have:

  • Fiddler Account: An active account with a GenAI application created

  • Python 3.10+

  • OpenTelemetry Packages:

    • pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http

  • LLM Provider (for examples): OpenAI API key or similar

  • Fiddler Access Token: Get your token from Settings > Credentials

For a complete working example with advanced patterns, download the Advanced OpenTelemetry Notebook from GitHub or open it in Google Colab.

1

Create Fiddler Application

  1. Log in to your Fiddler instance and navigate to GenAI Apps

  2. Select "Add Application" to create a new application

  3. Copy your Application ID - This must be a valid UUID4 format (e.g., 550e8400-e29b-41d4-a716-446655440000)

  4. Get your Access Token from Settings > Credentials

2

Configure Environment Variables

Set up your environment to connect to Fiddler's OTLP endpoint:

Environment Variable Breakdown:

Variable
Description
Example

OTEL_EXPORTER_OTLP_ENDPOINT

Your Fiddler instance URL

https://org.fiddler.ai

OTEL_EXPORTER_OTLP_HEADERS

Authentication and app ID headers

authorization=Bearer sk-...,fiddler-application-id=550e8400...

OTEL_RESOURCE_ATTRIBUTES

Resource-level application identifier

application.id=550e8400-e29b-41d4-a716-446655440000

Python Configuration (alternative to environment variables):

3

Initialize OpenTelemetry

Set up OpenTelemetry with Fiddler's OTLP exporter:

What This Does:

  • TracerProvider: Manages trace generation

  • OTLPSpanExporter: Exports spans to Fiddler via OTLP protocol

  • BatchSpanProcessor: Batches spans for efficient network transmission

Local Debugging: Add a console exporter to see traces locally while developing:

4

Instrument Your Agent

Create instrumented spans for your agent's operations. Fiddler requires specific attributes to properly categorize and visualize your agent traces.

Required Fiddler Attributes

Resource Level (set via environment variable):

  • application.id - UUID4 of your Fiddler application

Trace Level (required in all spans):

  • gen_ai.agent.name - Name of your AI agent

  • gen_ai.agent.id - Unique identifier for the agent

Span Level (required for each span):

  • fiddler.span.type - Type of operation: "chain", "tool", "llm", or "other"

Example: Simplified Travel Agent

Key Implementation Details:

  • Chain Spans: Use fiddler.span.type = "chain" for high-level workflows

  • LLM Spans: Include model, system prompt, user input, output, and token usage

  • Tool Spans: Include tool name, input JSON, and output JSON

  • Nested Spans: Create parent-child relationships to show execution flow

5

Verify Monitoring

  1. Run your instrumented code using the example above

  2. Wait 1-2 minutes for traces to appear in Fiddler

  3. Navigate to GenAI Apps in your Fiddler instance

  4. Verify application status changes to Active

  5. View traces to see your agent spans, hierarchy, and attributes

Success Criteria:

✅ Application shows as Active in GenAI Apps ✅ Traces appear with correct agent name ✅ Span hierarchy shows chain → LLM → tools relationship ✅ All required attributes are present (agent name, agent ID, span type) ✅ LLM token usage is tracked ✅ Tool inputs and outputs are captured

Attribute Reference

Required Attributes

Resource Level:

Attribute
Type
Description
Example

application.id

string

UUID4 of your Fiddler application

"550e8400-e29b-41d4-a716-446655440000"

Trace Level (all spans):

Attribute
Type
Description
Example

gen_ai.agent.name

string

Name of the AI agent

"travel_agent"

gen_ai.agent.id

string

Unique identifier for the agent

"travel_agent_v1"

Span Level:

Attribute
Type
Description
Valid Values

fiddler.span.type

string

Type of operation

"chain", "tool", "llm", "other"

Optional Attributes

Conversation Tracking:

Attribute
Type
Description
Example

gen_ai.conversation.id

string

Session/conversation identifier

"conv_123"

LLM Span Attributes:

Attribute
Type
Description
Example

gen_ai.request.model

string

Model name

"gpt-4o-mini", "claude-3-opus"

gen_ai.system

string

LLM provider

"openai", "anthropic"

gen_ai.llm.input.system

string

System prompt

"You are a helpful assistant"

gen_ai.llm.input.user

string

User input

"What's the weather?"

gen_ai.llm.output

string

LLM response

"The weather is sunny"

gen_ai.usage.input_tokens

int

Input tokens used

42

gen_ai.usage.output_tokens

int

Output tokens used

28

gen_ai.usage.total_tokens

int

Total tokens used

70

Tool Span Attributes:

Attribute
Type
Description
Example

gen_ai.tool.name

string

Tool/function name

"search_database"

gen_ai.tool.input

string

Tool input (JSON)

"{\"query\": \"hotels\"}"

gen_ai.tool.output

string

Tool output (JSON)

"{\"results\": [...]}"

Custom User-Defined Attributes:

Pattern
Level
Example

fiddler.session.user.{key}

Trace (all spans)

fiddler.session.user.user_id = "usr_123"

fiddler.span.user.{key}

Span (individual)

fiddler.span.user.department = "sales"

Troubleshooting

Common Issues

Problem: Application not showing as "Active"

Solutions:

  1. Verify environment variables are set correctly

  2. Check that OTEL_EXPORTER_OTLP_ENDPOINT includes your Fiddler instance URL

  3. Ensure OTEL_EXPORTER_OTLP_HEADERS contains valid authorization token and application ID

  4. Add console exporter to verify spans are being generated locally

  5. Check network connectivity: curl -I https://your-instance.fiddler.ai

Problem: ModuleNotFoundError for OpenTelemetry packages

Solutions:

Problem: Spans not appearing in Fiddler

Solutions:

  1. Verify required attributes are set:

  2. Check resource attributes:

  3. Enable console exporter for debugging:

Problem: Authentication errors (401 Unauthorized)

Solutions:

  1. Regenerate your access token from Fiddler Settings > Credentials

  2. Verify header format: authorization=Bearer <token>,fiddler-application-id=<uuid>

  3. Ensure no extra spaces in header values

  4. Check token hasn't expired

Problem: Invalid Application ID error

Solutions:

  1. Copy Application ID directly from Fiddler UI

  2. Verify UUID4 format: 550e8400-e29b-41d4-a716-446655440000

  3. Ensure no extra quotes or whitespace

Configuration Options

Basic Configuration

Advanced Configuration

High-Volume Applications (Batch Processing Tuning):

Environment Variable Configuration:

Sampling for Production (Reduce Volume):

Compression (Reduce Network Usage):

Using FiddlerClient Alternative (Simplified Setup):

If you have fiddler-langgraph installed, you can use FiddlerClient.get_tracer() for simplified setup:

This approach handles OTLP configuration automatically.

Next Steps

Now that you have OpenTelemetry integration working: