Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Flush message or wait for queue being fully drained #338

Open
arabold opened this issue Jul 6, 2017 · 1 comment
Open

Flush message or wait for queue being fully drained #338

arabold opened this issue Jul 6, 2017 · 1 comment

Comments

@arabold
Copy link

arabold commented Jul 6, 2017

This is a feature request and a follow-up of #167.

TL;DR: Provide a method Raven.flush() that waits for all messages to drain and the queue being empty.

Background

We're using raven-node in our AWS Lambda environment for quite a while now. It works very well! However, there's one caveat with AWS Lambda - after your code runs it pauses the node thread until the next request comes in. After about 15 minutes of being idle it terminates the process completely. That's all fine as long as you know and work with that.

I'm the author of the Serverless Sentry Plugin which simplifies integration of raven-node with the popular Serverless Framework. Due to the reason above, I like to make sure that all pending messages sent via captureMessage or captureException have been sent before returning and allowing AWS Lambda to fall asleep until the next request. So I need a way of knowing that all pending messages have been forwarded to Sentry.

Proposal

I'm aware of the callback parameter in raven captureMessage and captureException but this wouldn't be very practical for this case. Users still want to send out messages in the background without affecting their main application code chain. I.e. it's not an option to wait until raven has sent out its data (which takes around 300 msec) before continuing with the rest of the code. Instead I

At the end of the day there should be a function like Raven.flush() or similar to wait for all messages having drained. This would be the last call done in the AWS Lambda handler to ensure all errors have been reported before exiting.

@orfin
Copy link

orfin commented Nov 6, 2017

We also ran into the same issue. Currently it's almost impossible to properly set-up Sentry with AWS Lambda as its no way to make Sentry just "send" errors at the end of function invocation :-(

Any chances to implement way to "flush" errors queue? :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants