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

Save exception message when Notification breaks #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pbaranay
Copy link

It would be very useful to see the text of the exception that's thrown when sending a notification breaks. Here's a pull request to add a field storing this information to the model. Please let me know what you think!

@coveralls
Copy link

coveralls commented Sep 26, 2017

Coverage Status

Coverage increased (+0.4%) to 79.251% when pulling 466619f on exception-logging into b50aed0 on master.

@makingspace makingspace deleted a comment from coveralls Sep 26, 2017
Copy link
Contributor

@nicolasgrasset nicolasgrasset left a comment

Choose a reason for hiding this comment

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

Thanks @pbaranay, happy to discuss my comments more

@@ -85,6 +85,8 @@ class Status(EnumDict):

status = models.IntegerField(default=Status.CREATED)

exception = models.TextField(blank=True, default='')
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @pbaranay! Unfortunately, the Notification model is meant to be extremely lean since it's storing 100s of millions of entries in production.

I'd suggest moving this feature to separate table since most notifications shouldn't have any exception anyway!

self.status = self.Status.BROKEN
self.exception = "{klass}: {message}".format(klass=e.__class__.__name__, message=str(e))
Copy link
Contributor

Choose a reason for hiding this comment

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

Arguably, this could be done through a logging system rather than a permanent data store. I think logging would be a more suitable solution to introduce here since it's only assuming you've configured Django for it right now.

Either way you will want to make it configurable with settings. Logging is controlled by logging routes in settings, but if you introduce a new model/field, please add a setting.

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.

3 participants