Implementing Tracing
We recommend starting with the auto-instrumentation first. For advanced customization and granular control, you can directly utilize our OTEL-compliant instrumentation API.
1. Tracing Integrations: Quick Start (Auto-Instrumentation)
Implement trace logging effortlessly with our pre-built tracing integrations. These integrations offer flexibility for further customization as needed.
LLM Models | Orchestration Frameworks | Other |
---|---|---|
OpenAI | LlamaIndex | DSPY |
Vertex AI (Gemini) | Langchain | |
AWS Bedrock | Haystack | |
Mistral AI | LiteLLM | |
Anthropic | CrewAI | |
Groq |
2. Manual Instrumentation
For applications requiring precise control over trace data, Future AGI provides OpenTelemetry (OTEL) support. This enables custom span creation and modification using the OpenTelemetry Trace API.
Implementation Guide (Python)
Step 1: System Requirements
Prerequisites:
- Python version: 3.9 to 3.12
- Future AGI Instrumentation Package
Step 2: Set Environment Variables
Step 3: Configuring a Tracer
Setting up an OTEL tracer typically requires complex boilerplate code. Future AGI simplifies this process with our register helper function:
Step 4: Span Implementation
When using our Auto-Instrumenters, span creation is handled automatically. You can further customize these spans as needed.
For complete control over spans you can use manual instrumentation:
Next we create spans by starting spans and defining our name and other attributes:
You can also use start_span to create a span without making it the current span. This is usually done to track concurrent or asynchronous operations.
Implementing Nested Spans
Track sub-operations within larger operations by creating hierarchical span relationships:
In our platform child
span appears as a nested component under the parent
span.
Decorator Implementation
Use of the decorator is equivalent to creating the span inside process_operation()
and ending it when process_operation()
is finished.
To use the decorator, you must have a tracer instance in scope for your function declaration.