> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langtrace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set custom span names to traces

> Learn how to ett custom span names to traces in Langtrace. You can use the `inject_additional_attributes` function to set custom span names to traces. This name will be appended to the operation name and will be identifed as the name of the span in the trace.

## Overview

When you're using the Langtrace SDK with any of the supported vendors, you can set custom span names to traces. This allows you to identify the span in the trace with a custom name. You can use the `inject_additional_attributes` function to set custom span names to traces. This name will be appended to the operation name and will be identified as the name of the span in the trace.

Please see the example below to learn how to set custom span names to traces. Note that the key `langtrace.span.name` is used to pass the custom span name to the trace.

<Note>If you did not pass `langtrace.span.name` as key inside `inject_additional_attributes`, custom span naming will not work</Note>

```python theme={null}
from langtrace_python_sdk import inject_additional_attributes

class CoT(dspy.Module):
    def __init__(self):
        super().__init__()
        self.prog = dspy.ChainOfThought("question -> answer")

    def forward(self, question):
        result = inject_additional_attributes(lambda: self.prog(question=question), {'langtrace.span.name': 'MathProblemsCotParallel'})
        return result
```
