getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
936 stars 494 forks source link

AWS lambda support #1728

Open sl0thentr0py opened 2 years ago

sl0thentr0py commented 2 years ago

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

jordan-brough commented 2 years ago

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.

sl0thentr0py commented 2 years ago

@jordan-brough PRs are always welcome!

st0012 commented 2 years ago

@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?

sl0thentr0py commented 2 years ago

yes, thought the same.

sl0thentr0py commented 2 years ago

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

jordan-brough commented 2 years ago

👍 Sounds great, I'll do that.

jordan-brough commented 2 years ago

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.

sl0thentr0py commented 2 years ago

@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.

jordan-brough commented 2 years ago

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)

sl0thentr0py commented 2 years ago

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

Haumer commented 2 years ago

Just curious, is there any movement on this 😄 ?

sl0thentr0py commented 2 years ago

@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.

kuredev commented 1 year ago

📝 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.