From a45b62a46854f2890cbc74c7a1481fe5c0a3d710 Mon Sep 17 00:00:00 2001 From: Philipp von dem Bussche Date: Sun, 19 Aug 2018 14:01:43 +0200 Subject: [PATCH] Introducing aws_xray_tracing_config in config.yaml in order to set tracing active when deploying the function to AWS. By default or if nothing specified the configuration will remain PassThrough which is the default setting and which does not create any extra costs. However setting this to Active will cost (at least eventually). --- aws_lambda/aws_lambda.py | 9 +++++++++ aws_lambda/project_templates/config.yaml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/aws_lambda/aws_lambda.py b/aws_lambda/aws_lambda.py index 17c0126..9e765d9 100755 --- a/aws_lambda/aws_lambda.py +++ b/aws_lambda/aws_lambda.py @@ -539,6 +539,9 @@ def create_function(cfg, path_to_zip_file, use_s3=False, s3_file=None): 'SecurityGroupIds': cfg.get('security_group_ids', []), }, 'Publish': True, + 'TracingConfig': { + 'Mode': cfg.get('aws_xray_tracing_config', 'PassThrough') + }, } else: kwargs = { @@ -555,6 +558,9 @@ def create_function(cfg, path_to_zip_file, use_s3=False, s3_file=None): 'SecurityGroupIds': cfg.get('security_group_ids', []), }, 'Publish': True, + 'TracingConfig': { + 'Mode': cfg.get('aws_xray_tracing_config', 'PassThrough') + }, } if 'tags' in cfg: @@ -636,6 +642,9 @@ def update_function( 'SubnetIds': cfg.get('subnet_ids', []), 'SecurityGroupIds': cfg.get('security_group_ids', []), }, + 'TracingConfig': { + 'Mode': cfg.get('aws_xray_tracing_config', 'PassThrough') + }, } if 'environment_variables' in cfg: diff --git a/aws_lambda/project_templates/config.yaml b/aws_lambda/project_templates/config.yaml index 8029c80..41c12af 100644 --- a/aws_lambda/project_templates/config.yaml +++ b/aws_lambda/project_templates/config.yaml @@ -16,6 +16,9 @@ runtime: python2.7 aws_access_key_id: aws_secret_access_key: +# set xray tracing config to either PassThrough or Active +aws_xray_tracing_config: PassThrough + # dist_directory: dist # timeout: 15 # memory_size: 512