diff --git a/README.md b/README.md index f2e73344..08357229 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ A collection of scripts related to the Remote Settings service. ## Sentry -All commands use Sentry to report any unexpected errors. The `SENTRY_DSN` -environment variable is not required but is recommended. +All commands use Sentry to report any unexpected errors. Sentry can be configured with these environment variables, which are recommended, but not required: + +- `SENTRY_DSN`: The DSN from the "Client Keys" section in the project settings in Sentry. +- `SENTRY_ENV`: The environment to use for Sentry, e.g. dev, stage or prod. ## Commands diff --git a/aws_lambda.py b/aws_lambda.py index 5917392b..82d4c522 100755 --- a/aws_lambda.py +++ b/aws_lambda.py @@ -9,12 +9,16 @@ from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration SENTRY_DSN = config("SENTRY_DSN", default=None) +SENTRY_ENV = config("SENTRY_ENV", default=None) if SENTRY_DSN: # Note! If you don't do `sentry_sdk.init(DSN)` it will still work # to do things like calling `sentry_sdk.capture_exception(exception)` # It just means it's a noop. - sentry_sdk.init(SENTRY_DSN, integrations=[AwsLambdaIntegration()]) + env_option = {} + if SENTRY_ENV: + env_option = {"environment": SENTRY_ENV} + sentry_sdk.init(SENTRY_DSN, integrations=[AwsLambdaIntegration()], **env_option) def help_(**kwargs):