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 error bundling to help deal with high traffic #93

Closed
wants to merge 27 commits into from

Conversation

samuel-holt
Copy link
Contributor

Updates

  • Add a bundler class which populates an array with incoming messages
  • Send a bundle after certain conditions have been met. Either the number of messages in the bundle reaches the maximum bundle size (default 100) or after a time period (default 60s)
  • Post bundle to the bundle entries endpoint on the API

@samuel-holt samuel-holt requested a review from fundead May 4, 2017 04:40
$maxBundleSize = min(100, $settings["maxBundleSize"]);

if($this->bundleErrors) {
$this->path = '/bulk/entries';
Copy link
Contributor

@fundead fundead May 7, 2017

Choose a reason for hiding this comment

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

The route's now changed to /entries/bulk, would you mind updating this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

));

// Flush any leftover messages stored in the session which weren't bundled
if(isset($_SESSION) && isset($_SESSION["raygun_error_bundle"])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If they haven't called session_start() at this point what effect is there?

@fundead fundead changed the title Add basic error bundling to help deal with high traffic Add error bundling to help deal with high traffic May 8, 2017
$this->bundler->setBundle($bundle);

if(count($bundle) === 1) {
$this->Send($bundle[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are setting the bundle above, then won't sending the error at this point mean duplicate errors being sent to the API? One with the setBundle and then again when we call the Send method here?

$this->Send($bundle[0]);
}
else {
$this->SendBundle($bundle);
Copy link
Contributor

Choose a reason for hiding this comment

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

SendBundle doesn't accept any parameters. Also if we are retrieving it from storage couldn't we just add it to the current bundle and wait for it queued up by subsequent errors?

Perhaps this was intended to send the errors immediately after retrieving them again.


// Save to disk to disk if possible
if($this->writeToDisk && file_exists($storageFile) && is_writable($storageFile)) {
return file_put_contents($storageFile, "{$message}\n", FILE_APPEND);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if instead of writing to the file each time and then looking up the bundles each time a new request is made we could instead use the register_shutdown_function to just send the remaining errors in the bundle at the end.

@robbieaverill
Copy link
Contributor

@samuel-holt are you interested in reviving this pull request?

@samuel-holt samuel-holt closed this May 7, 2019
@samuel-holt samuel-holt deleted the add-error-bundling branch May 7, 2019 22:03
@samuel-holt
Copy link
Contributor Author

@robbieaverill Not particularly, I would be interested in adding this bundling functionality but with a different approach, I think this PR is stale and should be deleted

@robbieaverill
Copy link
Contributor

See #112 for future tracking

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.

None yet

4 participants