Skip to main content
A span represents a single unit of execution within a trace. Each span captures a discrete operation performed during a request lifecycle, such as an API call, model invocation, or tool execution, along with its timing, cost, and execution context. Spans are organized hierarchically within a trace, allowing you to understand how individual operations contribute to overall latency, cost, and system behavior.

Span Types

Netra supports five span types, each designed to categorize specific kinds of operations:

When to Use Each Type

Span (Default)
  • General-purpose operations that don’t fit other categories
  • Business logic and data processing
  • Workflow orchestration steps
Generation
  • OpenAI, Anthropic, or other LLM completions
  • Image generation (DALL-E, Stable Diffusion)
  • Text-to-speech or speech-to-text operations
Embedding
  • Converting text to vectors for similarity search
  • Embedding API calls (OpenAI embeddings, Cohere embed)
  • Document embedding pipelines
Tool
  • External API calls
  • Database operations
  • File system operations
  • Any function that performs a specific action
Agent
  • AI agents making autonomous decisions
  • ReAct-style reasoning loops
  • Multi-step task execution
  • Agent frameworks (LangGraph, CrewAI, AutoGen)

Specifying Span Types

When creating manual spans, specify the type using the as_type parameter:
Auto-instrumentation automatically assigns the correct span type based on the operation. For example, OpenAI chat completions are automatically marked as GENERATION spans.

Viewing Spans in Netra

Netra displays spans within the Trace Timeline as a hierarchical view of all operations executed during a request. Selecting a span highlights it in the timeline and surfaces its details in the Metadata panel, allowing you to inspect execution context without leaving the trace. Different span types are visually distinguished to help you quickly identify agent execution, model generations, and tool calls. Span

Span Attributes

Each span in Netra captures attributes in the Metadata panel. Some attributes are common across all span types, while others are specific to certain types. Generation spans also show additional data in Chat Preview including system prompt, user input, and assistant response.

Custom Attributes

You can add custom attributes to any span for additional context using set_attribute() / setAttribute(). See Manual Tracing for detailed examples of working with span attributes.

Adding Spans to Datasets

Spans can be added to a dataset using Add to Dataset for reuse in evaluations and testing workflows. This is useful for:
  • Building evaluation datasets from production data
  • Creating test cases for regression testing
  • Analyzing specific types of operations
See Evaluations for more details.

Learn More

Last modified on March 17, 2026