From 48145858b5c69c632b94d0be01dfe9864a096230 Mon Sep 17 00:00:00 2001 From: Nugusbayev Kanagat Date: Wed, 18 Oct 2023 15:46:43 +0600 Subject: [PATCH] minor polish --- .../apm/agent/awslambda/helper/S3TransactionHelper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java index f3b52c4640..e2203a665d 100644 --- a/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java +++ b/apm-agent-plugins/apm-awslambda-plugin/src/main/java/co/elastic/apm/agent/awslambda/helper/S3TransactionHelper.java @@ -79,8 +79,8 @@ protected void setTransactionTriggerData(Transaction transaction, S3Event s3Even cloudOrigin.withRegion(s3NotificationRecord.getAwsRegion()); if (null != s3NotificationRecord.getS3()) { - if (null != s3NotificationRecord.getS3().getBucket()) { - S3EventNotification.S3BucketEntity bucket = s3NotificationRecord.getS3().getBucket(); + S3EventNotification.S3BucketEntity bucket = s3NotificationRecord.getS3().getBucket(); + if (null != bucket) { ServiceOrigin serviceOrigin = transaction.getContext().getServiceOrigin(); serviceOrigin.withId(bucket.getArn()); serviceOrigin.withName(bucket.getName()); @@ -88,8 +88,8 @@ protected void setTransactionTriggerData(Transaction transaction, S3Event s3Even transaction.withOtelAttribute("aws.s3.bucket", bucket.getName()); } - if (null != s3NotificationRecord.getS3().getObject()) { - final S3EventNotification.S3ObjectEntity object = s3NotificationRecord.getS3().getObject(); + S3EventNotification.S3ObjectEntity object = s3NotificationRecord.getS3().getObject(); + if (null != object) { transaction.withOtelAttribute("aws.s3.key", object.getKey()); } }