Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: add user id to tracing (#1990)

cthomasbbebd958d2ef
diff --git a/letta/tracing.py b/letta/tracing.py
index 7ec712fc2..b4304a6c6 100644
--- a/letta/tracing.py
+++ b/letta/tracing.py
@@ -75,6 +75,11 @@ async def update_trace_attributes(request: Request):
for key, value in request.path_params.items():
span.set_attribute(f"http.{key}", value)
+ # Add user ID if available
+ user_id = request.headers.get("user_id")
+ if user_id:
+ span.set_attribute("user.id", user_id)
+
# Add request body if available
try:
body = await request.json()