> ## 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.

# Filtering Traces by Session ID

> Langtrace SDK allows you to pass a session ID to traces to filter them later.

## What is a Session ID?

A session ID is a unique identifier for a user session. It is useful to group traces together for a single user session.

## How to pass a session ID to traces

In order to pass a session ID to traces, you can use the `inject_additional_attributes` function (Python) or `withAdditionalAttributes` function (Typescript).

## Usage

For python, you can use the `inject_additional_attributes` function to pass a session ID to traces.

```python theme={null}
from langtrace.utils import inject_additional_attributes

inject_additional_attributes(lambda: None, {"session.id": "unique-session-id"})
```

For Typescript, you can use the `withAdditionalAttributes` function to pass a session ID to traces.

```typescript theme={null}
withAdditionalAttributes(async () => {
    // your code here
}, { "session.id": "unique-session-id" });
```

## How to filter traces by session ID

To filter traces by session ID, you can use the `session.id` filter in the UI. Additionally, you can also see the session ID of each trace in the UI.

<img src="https://mintcdn.com/langtraceai-2/-UwpI0EgGcwfnnlh/images/session_id_2.png?fit=max&auto=format&n=-UwpI0EgGcwfnnlh&q=85&s=eb60e7c01c91fb301b2ebf7205b1f267" alt="Filter Traces by Session ID" width="2012" height="1908" data-path="images/session_id_2.png" />

<img src="https://mintcdn.com/langtraceai-2/-UwpI0EgGcwfnnlh/images/session_id_1.png?fit=max&auto=format&n=-UwpI0EgGcwfnnlh&q=85&s=53436fe43df5b85ed2595ba50dd55515" alt="Session ID in Traces" width="3082" height="1774" data-path="images/session_id_1.png" />
