Skip to content

Commit

Permalink
adding additional event sources
Browse files Browse the repository at this point in the history
  • Loading branch information
brett-bim committed Feb 18, 2022
1 parent 22cc215 commit 684084b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,14 @@ def _instrumented_lambda_handler_call(

# See more:
# https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
# https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-content-structure.html
# https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html
span_kind = SpanKind.SERVER
valid_consumers = ["aws:sqs", "aws:s3", "aws:sns", "aws:dynamodb"]

try:
if lambda_event["Records"][0]["eventSource"] == "aws:sqs":
if lambda_event["Records"][0]["eventSource"] in valid_consumers:
span_kind = SpanKind.CONSUMER
except (IndexError, KeyError, TypeError):
span_kind = SpanKind.SERVER
Expand Down

0 comments on commit 684084b

Please sign in to comment.