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
Name traces by user action
Name traces by user action
Use names like
user-signup, document-upload, chat-message rather than technical names.Keep spans focused
Keep spans focused
Each span should represent one logical operation. Don’t create spans that are too broad or too narrow.
Add meaningful metadata
Add meaningful metadata
Include user IDs, feature flags, and other context that helps with debugging and analytics.
Handle errors properly
Handle errors properly
Traces and spans automatically capture errors, but you can add additional context.