Skip to content

Conversation

@NANDINI-star
Copy link
Contributor

Add Key Name column to LiteLLM_SpendLogs + filter to logs table on Team ID

Screenshot 2025-05-14 at 1 45 29 AM

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature

Changes

  • Added a new column key_name for LiteLLM_SpendLogs table, so that we can filter by key name value in the future.
  • Added Filter by Team ID enables filtering spend logs by Team ID.

Tested the feature using these test cases for the Logs Page as mentioned in the QA Checklist:

Logs Page test cases

  1. Go to Logs. Expand a log, verify you can view request details. Collapse, verify it collapses with store_prompts_in_spend_logs: true send a request. Ensure you can see both request / response content for /chat
  2. Click "Copy" icon for Request, paste it in a doc. Verify the request content matches
  3. Click "Copy" icon for Response, paste it in a doc. Verify the request content matches
  4. Expand a log, send 10 requests. Verify that the Expanded log does not change as you get traffic
    Use this to generate 10 requests, just run on your terminal
#!/bin/bash

for i in {1..10}; do
  echo "Request $i:"
  curl -i http://localhost:4000/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-PIp1h0RekR" \
  -d '{
    "model": "us-gpt-4",
    "messages": [
      {
        "role": "user",
        "content": "hi who is this."
      }
    ]
  }'
  echo -e "\n\n------------------------\n"
done

@vercel
Copy link

vercel bot commented May 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2025 4:45pm

@NANDINI-star NANDINI-star requested review from ishaan-jaff and krrishdholakia and removed request for ishaan-jaff May 13, 2025 16:45
@NANDINI-star NANDINI-star marked this pull request as draft May 13, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants