Overview
The Vals SDK includes a tracing feature for monitoring and debugging operations in your applications, such as LLM calls, tool executions, and logic flows. It integrates with OpenTelemetry to export traces to the Vals platform, providing visibility into your code’s execution.Introduction and Setup
Tracing allows you to track the flow of operations, capture inputs/outputs, and monitor performance. To get started, initialize a trace client with a name for your application or module:Basic Tracing with Decorators
The simplest way to add tracing is using the@trace.span decorator, which automatically captures function arguments as input and return values as output.
Synchronous Functions
Asynchronous Functions
Manual Span Control
For more control, use context managers to create spans manually. This is useful for wrapping specific code blocks or operations.Span Types and Hierarchy
Spans have types to categorize operations:- LOGIC (default): For general logic, data processing, or workflows.
- LLM: For language model interactions, with special attributes like model, usage, and reasoning.
- TOOL: For external tools or API calls.