Skip to content

Add analytics to the chat completions #5709

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

Merged
merged 2 commits into from
Jul 1, 2025
Merged

Conversation

Kerollmops
Copy link
Member

This PR adds new analytics (that can be disabled) to the chat completions route. You can find an example of the analytics on this page (internal).

"event_properties": {
  "avg_messages_per_request": 2,
  "models_used": {
      "gpt-3.5-turbo": 1
  },
  "requests.total_received": 1,
  "streaming_ratio": 1,
  "time_spent.avg": 0,
  "time_spent.max": 0,
  "time_spent.min": 0,
  "total_messages": 2,
  "total_non_streamed_requests": 0,
  "total_received": 1,
  "total_streamed_requests": 1,
  "total_succeeded": 1,
  "user-agent": [
    "yaak"
  ]
}

@Kerollmops Kerollmops added this to the v1.16.0 milestone Jun 24, 2025
@Kerollmops Kerollmops added the no db change The database didn't change label Jun 24, 2025
@Kerollmops Kerollmops requested a review from irevoire June 24, 2025 15:10
Copy link
Member

@irevoire irevoire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I don't think we need to use the complex version of the aggregator if we're not going to have multiple implementations for the same payload. What do you think?

@Kerollmops Kerollmops requested a review from ManyTheFish June 30, 2025 17:10
Copy link
Member

@ManyTheFish ManyTheFish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ManyTheFish ManyTheFish enabled auto-merge July 1, 2025 09:11
@ManyTheFish ManyTheFish dismissed irevoire’s stale review July 1, 2025 09:14

reviewed by many

@ManyTheFish ManyTheFish added this pull request to the merge queue Jul 1, 2025
Merged via the queue into main with commit e8b2bb3 Jul 1, 2025
13 checks passed
@ManyTheFish ManyTheFish deleted the analytics-chat-completions branch July 1, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no db change The database didn't change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants