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 support for report filtering #33

Merged
merged 1 commit into from
Aug 9, 2022
Merged

Conversation

Jellyfrog
Copy link
Contributor

@Jellyfrog Jellyfrog commented Jul 29, 2022

Adds the ability to prevent reports from being sent.

The motivation behind it that we need a way to dynamically allow/disallow reports from being sent, for example based on user preferences since we plan on introducing this on self hosted project(librenms).

(setting flare.key to null does nothing since the Client instance is setup on boot already)

Compared to filterExceptionsCallable it can also prevent logs and errors from being sent, and that's why it's in sendReportToApi() instead of shouldSendReport()

Usage is something like this:

Flare::filterReportsUsing(function(Report $report) {
  return false;
});

@Jellyfrog
Copy link
Contributor Author

The test errors are due to the workflow running "composer update", not sure the fix belongs in this PR

@Jellyfrog
Copy link
Contributor Author

@AlexVanderbist could the same be merged here?

@AlexVanderbist
Copy link
Contributor

Hi again @Jellyfrog, thanks for backporting this fix! Will tag it in a minute.

@AlexVanderbist AlexVanderbist merged commit 0e653f8 into facade:main Aug 9, 2022
@Jellyfrog Jellyfrog deleted the patch-1 branch August 9, 2022 11:41
Jellyfrog added a commit to Jellyfrog/flare-client-php-1 that referenced this pull request Aug 23, 2022
Current code will populate Flare::sentReports() even if it's filtered since the return from sendReportToApi() is not used:

$this->sendReportToApi($report);
return $report;

This is a regression from facade#33
Jellyfrog added a commit to Jellyfrog/flare-client-php-1 that referenced this pull request Aug 23, 2022
Current code will populate Flare::sentReports() even if it's filtered since the return from sendReportToApi() is not used:

$this->sendReportToApi($report);
return $report;

This is a regression from facade#33
Jellyfrog added a commit to Jellyfrog/flare-client-php-1 that referenced this pull request Aug 23, 2022
Current code will populate Flare::sentReports() even if it's filtered since the return from sendReportToApi() is not used:

$this->sendReportToApi($report);
return $report;

This is a regression from facade#33
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