Why Observability Matters
You Can’t Fix What You Can’t See
What Is a Trace?
A trace is a complete record of one interaction with your AI system.What a Trace Captures
Every AI Call
- Which model was used (GPT-4, Claude, etc.)
- What you sent to it (the prompt)
- What it responded with
- How many words/tokens were processed
- How much it cost
- How long it took
Every Search/Retrieval
- What question was searched for
- Which documents were found
- Which ones were actually used
- Which database was searched
- How long the search took
Every Tool Used
- If agents used calculators, APIs, or other tools
- What information was passed to each tool
- What each tool returned
- Whether tools succeeded or failed
Timing Information
- When each step started and finished
- How long each part took
- Total time for the whole interaction
Context and Metadata
- Which user made the request
- What session or conversation it’s part of
- Whether it’s production or testing
- Any custom labels you’ve added
A Simple Example
User asks: “What’s your refund policy?” The trace shows:Understanding Spans
A span is one step within a trace. If a trace is a recipe, each span is one instruction.Common Types of Spans
AI Model Calls
- Generating a response
- Answering a question
- Summarizing text
Database Searches
- Finding relevant documents
- Looking up information
- Retrieving data
Tool Executions
- Calling calculators
- Accessing external APIs
- Running functions
Agent Workflows
- Multi-step reasoning
- Planning and execution
- Decision-making processes
What Each Span Contains
Why This Information Is Valuable
Debugging Problems
Scenario: Users report AI is giving wrong answers about shipping.Improving Performance
Scenario: AI feels slow to users. Trace analysis shows:Controlling Costs
Scenario: AI costs are higher than expected. Trace analysis shows:- Set response length limits
- Warn users about expensive queries
- Optimize prompts to be more concise
Understanding Usage Patterns
Trace analysis reveals:What You Can Do with Traces
View Individual Traces
See exactly what happened in any interaction:- Click on any trace to open it
- See the step-by-step breakdown of all operations
- View inputs and outputs at each step
- Check which documents were retrieved and used
- Identify what went wrong (if anything)
Filter and Search
Find specific traces that need attention:- Show me all errors from last week
- Find traces that cost more than $0.10
- Show slow responses (over 5 seconds)
- Find traces for a specific user
- See traces using GPT-4 vs Claude
Compare Performance
Make before and after comparisons:- Did the new model improve quality?
- Are responses faster after optimization?
- Did costs go up or down?
- Is the new version better?
Track Trends
Analyze patterns over time:- Are errors increasing?
- Are we getting faster or slower?
- Are costs rising?
- Is quality improving?
Practical Examples
Finding Why Something Failed
Problem: User reports “AI said it doesn’t know, but the answer is definitely in our documentation.”Search for the user's query in traces
Find their trace from that time
Look at the Retrieved Documents section
Identify the mismatch
Diagnose the root cause
Optimizing for Cost
Observation: Monthly AI costs jumped 40% this month.Filter traces by cost
Sort from most to least expensive
Notice the pattern
Analyze the findings
- 5% of queries generate 60% of costs
- These are all “write a detailed report” type queries
- They generate 1000+ word responses
Implement solutions
- Limit response length to 500 words
- Ask users to be more specific
- Use cheaper model for long outputs
Improving Response Quality
Goal: Reduce errors in product recommendation questions.Filter for product recommendation traces with errors
Review what went wrong in each case
Identify the pattern
Diagnose the root cause
Implement the fix
Best Practices
Add Helpful Labels
- User type (free vs. paid customer)
- Feature name (chatbot, search, recommendations)
- Environment (production, staging, testing)
- Version number (v1.0, v2.0)
- Filter production issues from test issues
- Compare performance across features
- Identify problems affecting specific user types
- Track improvements across versions
Protect Privacy
- Don’t log passwords
- Be careful with personal information
- Avoid storing customer secrets
- Follow your privacy policies
- User IDs (not names)
- Session IDs
- Transaction IDs
- General query topics
Review Regularly
- Daily: Quick check for errors
- Weekly: Review slow or expensive traces
- Monthly: Look for trends and patterns
- After changes: Verify improvements worked
Set Up Alerts
- Error rate above 5%
- Average response time over 3 seconds
- Costs spike by 50%
- Specific feature failing
Common Use Cases
Customer Support Escalation
Scenario: Angry customer says “your AI is broken.”Look up their recent traces
See exactly what happened
Identify the specific issue
Respond with specifics
A/B Testing Different Approaches
Scenario: Testing two different prompts.Set up the test with proper tagging
- Version A: Tag traces with “prompt_v1”
- Version B: Tag traces with “prompt_v2”
Let the test run for 1 week
Analyze the results
- Average quality score: 3.8/5
- Average cost: $0.02
- Average time: 1.5s
- Average quality score: 4.2/5
- Average cost: $0.03
- Average time: 2.1s
Make a data-driven decision
Training and Quality Review
Scenario: Training your team on what good AI interactions look like.Filter for highly-rated traces
Review what made them successful
Filter for poorly-rated traces
Review what went wrong
Share findings with team
Monitoring Your AI System
Key Metrics to Track
Performance Metrics
- Average response time
- Percentage of slow responses (over X seconds)
- Success rate vs. error rate
Cost Metrics
- Average cost per query
- Daily/weekly/monthly total costs
- Cost per user or per feature
Quality Metrics
- User satisfaction scores
- Error rate by category
- Successful completion rate
Usage Metrics
- Number of queries per day
- Most common query types
- Peak usage times
What “Good” Looks Like
Troubleshooting Common Issues
Traces Aren't Showing Up
Traces Aren't Showing Up
- Is your application properly instrumented?
- Are traces being sent to the right place?
- Any network issues preventing transmission?
- Check your observability platform’s status
Too Many Traces to Review
Too Many Traces to Review
- Use filters to narrow down
- Focus on errors first
- Sample randomly (review 1% of successful traces)
- Set up automated quality checks
Can't Find Specific Traces
Can't Find Specific Traces
- Add better labels/tags when creating traces
- Use custom attributes for important context
- Search by user ID, session ID, or date
- Keep retention periods long enough
Getting Started
Week 1: Set Up Tracing
- Instrument your AI application
- Verify traces are being captured
- Check that key information is included
- Test with a few queries
Week 2: Add Context
- Add user IDs
- Tag by feature or environment
- Include version numbers
- Add business context
Week 3: Review and Analyze
- Look at recent errors
- Review slow traces
- Check expensive queries
- Identify patterns
Week 4: Establish Routine
- Daily error check
- Weekly performance review
- Monthly cost analysis
- Set up alerts for issues
