-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Unable to empty the buffer of events when running @sentry/node on AWS Lambda #3963
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
Comments
It's because our request buffer is configured to send up to 30 events concurrently. After it's full, any overflowing events are dropped. There is currently no way to configure the size of the buffer (we will introduce this in the future soon). If you want to send all the events, you need to limit the You can use any of these packages to achieve this: |
@kamilogorek thanks for the response. I've tried two approaches based on your suggestions but still without any luck successfully ingesting all events. Line replaced: return Promise.all(events.map(sendEventToSentry)); Option 1) import asyncPool from 'tiny-async-pool';
const SENTRY_EVENT_BUFFER = 30
return await asyncPool(SENTRY_EVENT_BUFFER, parse(body), sendEventToSentry) No difference observed - 30 events ingested. Option 2) const SENTRY_EVENT_BUFFER = 30
let validationErrors = parse(body);
while (validationErrors.length) {
await Promise.all(validationErrors.splice(0, SENTRY_EVENT_BUFFER).map(sendEventToSentry))
}
return await getCurrentHub().getClient().close(SENTRY_FLUSH_TIMEOUT_MS); This one behaves better. I can observe 1-4 buffer flushes (emitting 30-120 events per lambda run). The performance is however not deterministic. Do you maybe have any other ideas about what can be adjusted? |
@khozzy I was able to make it work using your exact code with
(just int) If that's the case, you need to force Sentry to "ungroup" them using fingerprints https://docs.sentry.io/platforms/node/usage/sdk-fingerprinting/ In your case, it will be as simple as (example trimmed to make it more readable): const sendEventToSentry = async event => {
Sentry.captureEvent({
message: event.message,
fingerprint: event.message
});
return Sentry.flush(2000); // you can return the flush, as async function will await the return value
};
You can do this in Changing this setting takes few minutes to kick in, so wait like ~5 minutes before retrying. Hope that will fix that. |
Closing as it seems the issue has been addressed. Please re-open if you have any other questions or feedback. Thanks! |
Package + Version
@sentry/node
Version:
Description
I'm running
sentry/node
on the AWS Lambda service. The intention is that when a certain file is created on an S3 bucket, its content is parsed and send to Sentry.The main parts of the code look as follow:
The problem is that every time the lambda is fired it sends a fixed number of 30 events (files contain more events to send).
In the logs, all items are listed. I'm running out of ideas why not all items are being picked up by the Sentry collector.
I tried troubleshooting it like in #1449, but with no success.
The text was updated successfully, but these errors were encountered: