Skip to content

Commit 6ddde25

Browse files
author
Peter Giacomo Lombardo
authored
AWS Lambda Safeties and Improvements (#279)
* AWS Lambda: Avoid setting arbitrary context * Do not double trace the boto3 exit
1 parent 16dde3d commit 6ddde25

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

instana/instrumentation/aws/lambda_inst.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ def lambda_handler_with_instana(wrapped, instance, args, kwargs):
3131
result['headers']['Server-Timing'] = server_timing_value
3232
elif 'multiValueHeaders' in result:
3333
result['multiValueHeaders']['Server-Timing'] = [server_timing_value]
34-
else:
35-
# If both 'headers' and 'multiValueHeaders' aren't in result,
36-
# then default to setting single value 'headers'
37-
result['headers'] = dict()
38-
result['headers']['Server-Timing'] = server_timing_value
3934
except Exception as exc:
4035
if scope.span:
4136
scope.span.log_exception(exc)

instana/instrumentation/urllib3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def collect_response(scope, response):
6262
def urlopen_with_instana(wrapped, instance, args, kwargs):
6363
parent_span = tracer.active_span
6464

65-
# If we're not tracing, just return
66-
if parent_span is None:
65+
# If we're not tracing, just return; boto3 has it's own visibility
66+
if parent_span is None or parent_span.operation_name == 'boto3':
6767
return wrapped(*args, **kwargs)
6868

6969
with tracer.start_active_span("urllib3", child_of=parent_span) as scope:

0 commit comments

Comments
 (0)