-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add latency metrics #4472
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
Add latency metrics #4472
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
e0993ff
to
8c42f46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR integrates latency metrics across the chat and authentication flows to support monitoring in Grafana.
- backend/onyx/server/query_and_chat/chat_backend.py: Introduces start-time tracking and logs document retrieval latency when a 'top_documents' key is present; ensure duplicate logs aren’t triggered inadvertently.
- backend/onyx/auth/users.py: Applies
log_function_time
on crucial async methods (e.g.,oauth_callback
andauthenticate
) to capture performance data. - backend/onyx/chat/process_message.py: Removes inline timing calls to streamline measurement via centralized telemetry.
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
@@ -448,6 +449,10 @@ def stream_generator() -> Generator[str, None, None]: | |||
), | |||
is_connected=is_connected_func, | |||
): | |||
if isinstance(packet, dict) and "top_documents" in packet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems problematic, no? stream_chat_message yields strs not dicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor nit
* k * update * Update chat_backend.py nit --------- Co-authored-by: evan-danswer <[email protected]>
Description
Fixes https://linear.app/danswer/issue/DAN-1777/track-latency-metrics
These should give us enough information to construct latency metrics in Grafana
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.