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

Add option to prevent duplicated events or limit frequency #74

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

Conversation

satrun77
Copy link
Contributor

@satrun77 satrun77 commented Feb 19, 2024

Includes 2 features

  • Limit events sent to Raygun to one per an error message
  • Reduce events sent to Raygun to every x seconds

Limit Raygun events

Add the following to your YML configuration to limit sending one Raygun event per error message.

SilverStripe\Raygun\RaygunHandler:
  enabled_limit: true

Error identified using the record fields (message, level.value, channel). It can be updated using the hook

use Monolog\LogRecord;

class RaygunExtension extends Extension {
    public function updateErrorKey(&$errorKey, LogRecord $record) {
        $errorKey = 'New value';
    }
}

Reduce Raygun events frequency

Add the following to your YML configuration, value is number of seconds.

SilverStripe\Raygun\RaygunHandler:
  report_frequency: 300 # Similar error message sent to Raygun every 5 minutes

Unit tests:
https://github.com/satrun77/silverstripe-raygun/actions/runs/7954518857

@satrun77 satrun77 force-pushed the pulls/prevent-repeat-notification branch from 459b62d to cb2d2f9 Compare February 19, 2024 04:18
@satrun77 satrun77 marked this pull request as ready for review February 19, 2024 04:19
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.

1 participant