From 556bd8a76e22a9a3c5c0aacd3e883a0bc8f737ed Mon Sep 17 00:00:00 2001 From: Oleksiy Dubinin Date: Tue, 8 Aug 2023 17:43:36 +0200 Subject: [PATCH] #894: further null-check improvements --- .../Implementation/AWSMessagingUtils.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSMessagingUtils.cs b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSMessagingUtils.cs index 2132600e9e..3353391c74 100644 --- a/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSMessagingUtils.cs +++ b/src/OpenTelemetry.Instrumentation.AWSLambda/Implementation/AWSMessagingUtils.cs @@ -75,10 +75,7 @@ internal static PropagationContext ExtractParentContext(SQSEvent.SQSMessage sqsM // SQS subscribed to SNS topic with raw delivery disabled case, i.e. SNS record serialized into SQS body. // https://docs.aws.amazon.com/sns/latest/dg/sns-large-payload-raw-message-delivery.html SNSEvent.SNSMessage? snsMessage = GetSnsMessage(sqsMessage); - if (snsMessage != null) - { - parentContext = ExtractParentContext(snsMessage); - } + parentContext = ExtractParentContext(snsMessage); } return parentContext; @@ -99,7 +96,7 @@ internal static PropagationContext ExtractParentContext(SNSEvent.SNSRecord? reco default; } - internal static PropagationContext ExtractParentContext(SNSEvent.SNSMessage message) + internal static PropagationContext ExtractParentContext(SNSEvent.SNSMessage? message) { return (message?.MessageAttributes != null) ? Propagators.DefaultTextMapPropagator.Extract(default, message.MessageAttributes, SnsMessageAttributeGetter) :