Skip to content
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

fix: report generation errors to sentry w/ model name #47

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

sambarnes
Copy link
Collaborator

Details

previously, any errors during the generate( method would only get printed

because the sentry_sdk is already initialized by the time this logic is hit, we can use logging.exception( to bubble up to sentry

the log entry in modal will be more visible with the ERROR level, and automatically includes the stack trace because of the .exception( use instead of plain .error(
image

additionally, i've included the model in the extra params. doesn't look like it shows in modal but it will show in datadog once thats hooked up. its already visible in the sentry error tho:

image

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I agree to license this contribution under the MIT LICENSE
  • I checked the current PR for duplication.

Comment on lines +120 to +122
logging.exception(
"Failed generation", extra={"model": self.engine_args.model}
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

opted to not convert the above print( to logging.info yet because in my test it did not show on modal (i think its because the default logger is set to WARN level, but we can followup with logging everywhere later. just a targeted change here for now)

Copy link
Contributor

Choose a reason for hiding this comment

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

I hit the same thing, logging.basicConfig(level=logging.INFO) fixed it

@montasaurus montasaurus merged commit 8447de1 into OpenRouterTeam:main Jan 12, 2024
3 checks passed
@sambarnes sambarnes deleted the sentry-generation branch January 12, 2024 16:57
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