FAQ
How to use ABV Tracing in Serverless Functions (AWS Lambda, Vercel, Cloudflare Workers, etc.)
How to use ABV Tracing in Serverless Functions (AWS Lambda, Vercel, Cloudflare Workers, etc.)
In short-lived serverless environments, you must explicitly flush traces before the process exits or the runtime environment is frozen.For JS/TS:Export the processor from your Then call For Vercel Cloud Functions, use the For Python:For complete shutdown (no more events will be sent):
instrumentation.ts file:instrumentation.ts
forceFlush() before the function exits:handler.ts
after utility:How do I track LLM cost and tokens in ABV?
How do I track LLM cost and tokens in ABV?
ABV tracks usage and costs of your LLM generations with breakdowns by usage types (input, output, cached tokens, audio tokens, etc.).Option 1: Ingest usage and cost (most accurate)Many ABV integrations automatically capture usage from LLM responses. You can also manually ingest them:Python SDK:JS/TS SDK:Option 2: Infer usage and cost automaticallyIf you donât ingest usage/cost, ABV will automatically infer them based on the
model parameter. ABV includes predefined models and tokenizers for OpenAI, Anthropic, and Google models.You can also add custom model definitions via the ABV UI or API for your own models.Why are the input and output of a trace empty?
Why are the input and output of a trace empty?
Empty inputs and outputs typically occur when:
- You didnât set them: Make sure to call
.update()withinputandoutputparameters:
-
Timing issues in serverless: If the function exits before data is flushed, use
abv.flush()(Python) orawait abvSpanProcessor.forceFlush()(JS/TS). - Data was masked: Check if you have masking rules that might be removing sensitive data.
How to enable or disable ABV tracing?
How to enable or disable ABV tracing?
To disable tracing entirely:Python SDK:Simply donât initialize the ABV client or donât use the To use sampling (partial tracing):Configure sampling rate via environment variable or in code:Python:JS/TS:
@observe decorator.JS/TS SDK:Donât import the instrumentation.ts file, or conditionally initialize it:How to manage different environments in ABV?
How to manage different environments in ABV?
Environments help you organize traces from different contexts (production, staging, development).Set via environment variable (recommended):Python SDK:JS/TS SDK:The environment is automatically attached to all traces, observations, scores, and sessions. You can filter by environment in the ABV UI.Environment naming rules:
.env
- Cannot start with âabvâ
- Only lowercase letters, numbers, hyphens, and underscores
- Maximum 40 characters
I have setup ABV, but I do not see any traces in the dashboard. How to solve this?
I have setup ABV, but I do not see any traces in the dashboard. How to solve this?
Common causes and solutions:
-
Missing flush in serverless/short-lived applications:
- Python: Call
abv.flush()before exit - JS/TS: Call
await abvSpanProcessor.forceFlush()before exit
- Python: Call
-
Incorrect API credentials:
- Verify your API key is correct
- Check if youâre using the right region (US:
https://app.abv.dev, EU:https://eu.app.abv.dev) - Python: Use
abv.auth_check()to verify credentials (donât use in production)
-
Instrumentation not loaded:
- JS/TS: Ensure
import "./instrumentation"is the FIRST import in your application - Python: Ensure youâve initialized the client with
get_client()orABV()
- JS/TS: Ensure
-
Network/firewall issues:
- Check if your application can reach the ABV API
- Verify no proxy/firewall is blocking requests
-
Sampling is too aggressive:
- Check if you have sampling enabled that might be filtering out traces
- Temporarily set sample rate to 1.0 (100%) to test
-
Wrong project:
- Verify youâre looking at the correct project in the ABV UI
- Check if the API key belongs to the project youâre viewing
-
For JS/TS with @vercel/otel:
- Use manual OpenTelemetry setup via
NodeTracerProviderinstead ofregisterOTelfrom@vercel/otel - The @vercel/otel package doesnât support OpenTelemetry JS SDK v2 yet
- Use manual OpenTelemetry setup via
-
Check the logs:
- Enable debug logging to see whatâs happening
- Python: Set log level in code
- JS/TS: Set
ABV_LOG_LEVEL="DEBUG"in environment variables
Where do I find my ABV API keys?
Where do I find my ABV API keys?
- Sign in to your ABV account at https://app.abv.dev
- Navigate to Project Settings
- Go to the API Keys section
- Click Create new API credentials
.env
What's the difference between spans, generations, and events?
What's the difference between spans, generations, and events?
ABV uses OpenTelemetry concepts with LLM-specific enhancements:Spans (Observations):Use generations for LLM calls, spans for other operations, and events for point-in-time logs.
- Generic units of work in your application
- Can be nested to form a tree structure
- Examples: API calls, database queries, function executions
- Created with
start_as_current_span()orstartActiveObservation()
- Special type of span specifically for LLM calls
- Include additional fields:
model,usage,cost - Automatically tracked for metrics and costs
- Created with
as_type="generation"parameter - Examples: OpenAI completion, Anthropic message, embeddings
- Point-in-time occurrences with no duration
- Lightweight, donât have start/end times
- Examples: logging, status updates, warnings
- Created with
add_event()method
- Collection of related spans/observations
- Represent a complete workflow or request
- All spans in a trace share the same
trace_id
How do I add metadata and tags to traces?
How do I add metadata and tags to traces?