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

Implemented a more robust filtering mechanism #81

Merged
merged 4 commits into from
Feb 16, 2018

Conversation

coryvirok
Copy link
Contributor

You can now add custom filtering logic to determine if the error/message/payload
should be sent to Rollbar.

e.g. Only send messages that match a regular expression:

import re

import rollbar
from rollbar import events

def ignore_unimportant_messages(message, **kw):
    if re.search(r'everthing is broken', message):
        return message
    return False

events.add_message_handler(ignore_unimportant_messages)

# This will not report to Rollbar
rollbar.report_message('everything is fine...')
# This will report to Rollbar
rollbar.report_message('everything is broken')

@brianr cc @Crisfole

@coryvirok coryvirok requested a review from rokob June 9, 2017 23:26
@coryvirok coryvirok self-assigned this Jun 9, 2017
@rivkahstandig3636
Copy link
Contributor

@rokob Could you please review this?

You can now add custom filtering logic to determine if the error/message/payload
should be sent to Rollbar.

e.g. Only send messages that match a regular expression:

```py
import re

import rollbar
from rollbar import events

def ignore_unimportant_messages(message, **kw):
    if re.search(r'everthing is broken', message):
        return message
    return False

events.add_message_handler(ignore_unimportant_messages)

"""Don't report to Rollbar"""
rollbar.report_message('everything is fine...')

"""Report to Rollbar"""
rollbar.report_message('everything is broken')
```

@brianr cc @chrisfole
Copy link
Contributor

@rokob rokob left a comment

Choose a reason for hiding this comment

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

I rebased this on master and fixed it up to pass tests. It looks good to me for adding this functionality. This entire library needs a lot of refactoring so adding this in this way seems reasonable at this time to get this PR out of the queue.

@rokob rokob merged commit b4bcae4 into master Feb 16, 2018
@rokob rokob deleted the feature/better-filtering branch June 11, 2018 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants