-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add Prometheus metric to track callback logging failures in S3 #16102
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
Changes from 7 commits
a140480
627e8e0
4dc1807
3885514
c18cbf0
0c6db47
ffaaa14
0dafd8d
5263a2f
bd9ebc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,7 +239,7 @@ async def _async_log_event_base(self, kwargs, response_obj, start_time, end_time | |
| ) | ||
| except Exception as e: | ||
| verbose_logger.exception(f"s3 Layer Error - {str(e)}") | ||
| pass | ||
| self.handle_callback_failure(callback_name="S3Logger") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which would be less work over time:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @krrishdholakia 2nd one is less work but the problem is periodic_flush and all method used in it don't raise error or propagate it to litellm_logging. Plus there are tasks which are fire-and-forget which I wasn't able find a way to bubble up those errors. The method I used was making sure that if an error comes, it will get logged in Prometheus There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @krrishdholakia is this good with you ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, let's start here |
||
|
|
||
| async def async_upload_data_to_s3( | ||
| self, batch_logging_element: s3BatchLoggingElement | ||
|
|
@@ -323,6 +323,7 @@ async def async_upload_data_to_s3( | |
| response.raise_for_status() | ||
| except Exception as e: | ||
| verbose_logger.exception(f"Error uploading to s3: {str(e)}") | ||
| self.handle_callback_failure(callback_name="S3Logger") | ||
|
|
||
| async def async_send_batch(self): | ||
| """ | ||
|
|
@@ -471,6 +472,7 @@ def upload_data_to_s3(self, batch_logging_element: s3BatchLoggingElement): | |
| response.raise_for_status() | ||
| except Exception as e: | ||
| verbose_logger.exception(f"Error uploading to s3: {str(e)}") | ||
| self.handle_callback_failure(callback_name="S3Logger") | ||
|
|
||
| async def _download_object_from_s3(self, s3_object_key: str) -> Optional[dict]: | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6377,4 +6377,4 @@ async def async_text_to_speech_handler( | |
| model=model, | ||
| raw_response=response, | ||
| logging_obj=logging_obj, | ||
| ) | ||
| ) | ||
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.
you can use logging_callback_manager to get you all the callbacks and then just run this
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.
agreed @Sameerlite can you please make the changes
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.
Updated the code