Group Related Operations
The Langtrace SDK allows you to group related operations together using the @with_langtrace_root_span
decorator for Python or WithLangTraceRootSpan
for Typescript.
How to group traces
A typical application may have multiple operations that are related to each other. For example, in a RAG workflow, the user’s input is embedded using a model, a semantic search is done on a VectorDB, and the results are again given back to the model to get a natural language response. In such cases, it is useful to group these operations together under a single root span. This allows you to see the entire flow of operations in a single trace.
Installation
Step 1: Install and initialize Langtrace SDK. Refer to the installation guide for more information.
Usage
Step 2: Use the with_langtrace_root_span
decorator (Python) or WithLangTraceRootSpan
(Typescript) function. Example below: