sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

AWS lambda support

Open sl0thentr0py opened this issue 4 years ago • 13 comments

For instrumenting AWS Lambda, it seems like it'd be ideal to use Lambda Extensions to deliver error reports. At first glance it looks like the async option would be the way to integrate with Lambda Extensions. Do any of the Sentry libraries for other languages hook into Lambda Extensions? Would there be another way to do that with the Sentry Ruby SDK?

Originally posted by @jordan-brough in https://github.com/getsentry/sentry-ruby/issues/1522#issuecomment-1036541210

sl0thentr0py avatar Feb 14 '22 11:02 sl0thentr0py

Would you accept a PR adding Lambda support to sentry-ruby?

I have some good experience with Lambda and we're using Sentry+Ruby+Lambda right now. I just finished adding basic support to our own app, including copying some of Sentry's work on e.g. https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/aws_lambda.py.

jordan-brough avatar Feb 14 '22 14:02 jordan-brough

@jordan-brough PRs are always welcome!

sl0thentr0py avatar Feb 14 '22 14:02 sl0thentr0py

@jordan-brough thanks for the offering. but can we make it under the sentry-lambda folder? I feel that it should be a standalone gem like sentry-rails. @sl0thentr0py wdyt?

st0012 avatar Feb 14 '22 16:02 st0012

yes, thought the same.

sl0thentr0py avatar Feb 14 '22 16:02 sl0thentr0py

Also for consistency, please call it sentry-serverless if you do make it.

sl0thentr0py avatar Feb 14 '22 16:02 sl0thentr0py

👍 Sounds great, I'll do that.

jordan-brough avatar Feb 14 '22 16:02 jordan-brough

Also for consistency, please call it sentry-serverless if you do make it.

@sl0thentr0py this is completely up to y'all, but "serverless" is a pretty broad term within AWS, e.g. see everything they list here: https://aws.amazon.com/serverless/#Serverless_services_on_AWS and this code will only apply to the Lambda part of serverless.

Also, serverless is used beyond AWS, e.g. Azure: https://azure.microsoft.com/en-us/solutions/serverless/ and this code would be specific to AWS Lambda and not e.g. Azure Functions.

So sentry-lambda might actually be a more specific and durable name for this.

But again I don't have a stake in that so totally up to y'all! Just lmk.

jordan-brough avatar Feb 14 '22 17:02 jordan-brough

@jordan-brough you're not wrong but I was mainly thinking about consistency with our npm package naming. If we do get this ball rolling, we would also look at GCP/azure in the distant future.

sl0thentr0py avatar Feb 14 '22 18:02 sl0thentr0py

Yah that makes sense. I was wondering if you might want to chat w/ whoever maintains the node/python libraries about considering a rename on their end also. "Lambda" seems like the overall better name to me in this case. But I'll plan on sentry-serverless unless I hear otherwise.

(I'm assuming that a future Azure/GCP addition would probably be in a different gem/package, since I'd wager there are enough differences to merit that)

jordan-brough avatar Feb 14 '22 18:02 jordan-brough

I doubt we'll rename those libs at this point since they've been around for much longer, sry!

sl0thentr0py avatar Feb 14 '22 18:02 sl0thentr0py

Just curious, is there any movement on this 😄 ?

Haumer avatar Apr 04 '22 16:04 Haumer

@Haumer not specifically, but in the medium long term, we're working on a partially cross-language solution with the AWS Extensions API that we'll release in a couple of months for other languages. Once that is done, we'd still need to add some ruby specific code but eventually we will also use that solution in the ruby SDK.

sl0thentr0py avatar Apr 07 '22 19:04 sl0thentr0py

📝 I recently used the Sentry SDK with AWS Lambda. With the default settings, due to SDK's asynchronous processing, the Lambda process terminated before sending to Sentry, resulting in failure to send to Sentry. To avoid this, by setting background_worker_threads to 0, I was able to successfully send to Sentry using Lambda.

kuredev avatar Sep 11 '23 05:09 kuredev