File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
tests/integrations/aws_lambda Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 11"""
22For manual instrumentation,
33The Handler function string of an aws lambda function should be added as an
4- environment variable with a key of 'INITIAL_HANDLER ' along with the 'DSN'
4+ environment variable with a key of 'SENTRY_INITIAL_HANDLER ' along with the 'DSN'
55Then the Handler function sstring should be replaced with
66'sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler'
77"""
1717
1818# Configure Sentry SDK
1919sentry_sdk .init (
20- dsn = os .environ ["DSN " ],
20+ dsn = os .environ ["SENTRY_DSN " ],
2121 integrations = [AwsLambdaIntegration (timeout_warning = True )],
22+ traces_sample_rate = float (os .environ ["SENTRY_TRACES_SAMPLE_RATE" ])
2223)
2324
2425
2526def sentry_lambda_handler (event , context ):
2627 # type: (Any, Any) -> None
2728 """
2829 Handler function that invokes a lambda handler which path is defined in
29- environment vairables as "INITIAL_HANDLER "
30+ environment vairables as "SENTRY_INITIAL_HANDLER "
3031 """
3132 try :
32- module_name , handler_name = os .environ ["INITIAL_HANDLER " ].rsplit ("." , 1 )
33+ module_name , handler_name = os .environ ["SENTRY_INITIAL_HANDLER " ].rsplit ("." , 1 )
3334 except ValueError :
3435 raise ValueError ("Incorrect AWS Handler path (Not a path)" )
3536 lambda_function = __import__ (module_name )
Original file line number Diff line number Diff line change @@ -45,8 +45,9 @@ def build_no_code_serverless_function_and_layer(
4545 Timeout = timeout ,
4646 Environment = {
4747 "Variables" : {
48- "INITIAL_HANDLER" : "test_lambda.test_handler" ,
49- "DSN" : "https://123abc@example.com/123" ,
48+ "SENTRY_INITIAL_HANDLER" : "test_lambda.test_handler" ,
49+ "SENTRY_DSN" : "https://123abc@example.com/123" ,
50+ "SENTRY_TRACES_SAMPLE_RATE" : "1.0" ,
5051 }
5152 },
5253 Role = os .environ ["SENTRY_PYTHON_TEST_AWS_IAM_ROLE" ],
You can’t perform that action at this time.
0 commit comments