getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
40.86k stars 4.34k forks source link

Sunset Sentry AWS Lambda Integration #88524

Open Lms24 opened 1 month ago

Lms24 commented 1 month ago

Problem Statement

Currently, there are multiple ways how we instruct users to install Sentry SDKs in their AWS Lambda functions, one of them being the Sentry AWS Lambda Integration. This integration is currently un-owned and at least for NodeJS problematic because it does not support ESM-based lambdas. Therefore, the SDK team decided to sunset the integration.

Current state of AWS Lambda setup documentation

- In-product onboarding prmarily recommends and integrates our AWS Lambda Integration ![Image](https://github.com/user-attachments/assets/b780be41-2a0b-4178-a4aa-de2fed5bc327) ![Image](https://github.com/user-attachments/assets/fd25d2b1-8ed9-4d9b-ad93-42880f696391) but it also provides a fallback to manual setup (which only shows CJS and NPM package-based setup: ![Image](https://github.com/user-attachments/assets/a459186f-38e9-4b1a-bc7c-a1b96e6981ce) - SDK Docs show our recommended way of using the function: Adding a layer to the Lambda functions and initializing the SDK via environment variables. In JS-ESM specific guides, we recommend an NPM-based approach due to the lack of a functioning ESM Lambda layer. Improving this is tracked in https://github.com/getsentry/sentry-javascript/issues/12856 and out of scope for this issue. Examples: [Node (CJS)](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/install/cjs-layer/), [Node (ESM)](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/install/esm-npm/), [Python](https://docs.sentry.io/platforms/python/integrations/aws-lambda/manual-layer/), [.NET](https://docs.sentry.io/platforms/dotnet/guides/aws-lambda/) (which AFAICT, is not supported in the integration and doesn't publish a layer) - [Cloud Monitoring docs](https://docs.sentry.io/organization/integrations/cloud-monitoring/aws-lambda/) only mention our AWS integration with a few caveats that it doesn't work in certain scenarios (e.g. Node ESM lambdas).

Solution Brainstorm

After an internal discussion, we decided to sunset our AWS Lamda integration.

Why sunset out AWS Lambda integration?

From a user's PoV, the integration therefore:

In contrast to the integration, our recommended approaches will show the easiest manual setup path per platform. This usually means adding a Lambda layer and setting environment variables. In special cases (JS ESM, .NET), it currently requires more manual setup/code modifications. But these are required anyway and the integration couldn't have helped us here. Terraform/Lambda abstraction users can simply replace the manual layer and env variable setup with their IaC strategy.

Course of Action

Sunsetting the AWS integration involves multiple steps:

  1. Remove our AWS Lambda integration from in-product onboarding
  2. Remove docs mentioning our AWS Lambda integration and clean up documentation
    • Prefer AWS layers or direct in-code alternatives
    • Nice to have: provide guidance on Terraform-based setups (?)
  3. (Specifics TBD): Hide AWS Lambda integration from newly created projects/orgs
    • Is there precedence with other integrations we can base this step on?
  4. Eventually completely remove AWS Lambda integration

Once we pick this up, we can extract these steps into dedicated sub issues

Customer Impact

Product Area

Integrations, Onboarding, SDK Docs, Product Docs

Lms24 commented 1 month ago

Migration Path

What happens when moving away from a Lambda function that was originally instrumented via the integration to manually upgrading and managing the lambda layer

  1. Created a new org and new project in Sentry
  2. Created a new AWS Lambda function in the AWS console.
  3. Converted it to CJS and verified that it's still executed correctly
  4. Added Sentry via the integration
    • welp, tried to add sentry via the integration but it simply did nothing :( No layer was added and neither were env variables set :(
    • so instead, I just added the layer manually to simulate what the integration should do
  5. Sent an error and trace to Sentry to verify correctness
  6. Removed the AWS Lambda integration from my new org
  7. Error and trace were still sent correctly
  8. updated to another layer in AWS console
  9. Error and trace were still sent correctly
bruno-garcia commented 1 month ago

btw we didn't bother adding AWS support in .NET because most .NET ppl use Azure. We added GCP early on because it was like 10 lines of code, but adoption is extremely low.