Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlobs] improve docs for user session tracking #25955

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions content/en/llm_observability/setup/sdk/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,29 @@

## Tracking user sessions

Session tracking allows you to associate multiple interactions with a given user. When starting a root span for a new trace or span in a new process, specify the `session_id` argument with the string ID of the underlying user session:
Session tracking allows you to associate multiple interactions with a given user. When starting a root span for a new trace or span in a new process, specify the `session_id` argument with the string ID of the underlying user session, which is submitted as a tag on the span. Optionally, you can also specify the `user_handle`, `user_name`, and `user_id` tags.

Check notice on line 359 in content/en/llm_observability/setup/sdk/_index.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.sentencelength

Suggestion: Try to keep your sentence length to 25 words or fewer.

{{< code-block lang="python" >}}
from ddtrace.llmobs.decorators import workflow

@workflow(session_id="<SESSION_ID>")
def process_message():
... # user application logic
def process_user_message():
LLMObs.annotate(
...
tags = {"user_handle": "[email protected]", "user_id": "1234", "user_name": "poodle"}
)
return
{{< /code-block >}}

### Session Tracking Tags

Check warning on line 373 in content/en/llm_observability/setup/sdk/_index.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.headings

'Session Tracking Tags' should use sentence-style capitalization.

| Tag | Description |
|---|---|
| `session_id` | The ID representing a single user session, for example, a chat session. |
| `user_handle` | The handle for the user of the chat session. |
| `user_name` | The name for the user of the chat session. |
| `user_id` | The ID for the user of the chat session. |

## Annotating a span

The SDK provides the method `LLMObs.annotate()` to annotate spans with inputs, outputs, and metadata.
Expand Down
Loading