Skip to main content
Tracing helps you understand the flow of operations in your LLM application by grouping related calls together.

Trace Hierarchy

Muxx uses a hierarchical tracing model:

Creating Traces

With Decorators

With Context Manager

Manual Trace Management

Creating Spans

Spans represent individual operations within a trace.

With Decorators

With Context Manager

Nested Spans

Spans can be nested to represent sub-operations:

Adding Metadata

To Traces

To Spans

Trace Context

Access the current trace context:

Async Tracing

Tracing works seamlessly with async code:

Best Practices

Use names like user-signup, document-upload, chat-message rather than technical names.
Each span should represent one logical operation. Don’t create spans that are too broad or too narrow.
Include user IDs, feature flags, and other context that helps with debugging and analytics.
Traces and spans automatically capture errors, but you can add additional context.