Skip to content

Commit d3b7e6b

Browse files
committed
add conditional check before extracting sqs queue url for cfn primary id in queue name case
1 parent 08ba010 commit d3b7e6b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ def _set_remote_type_and_identifier(span: ReadableSpan, attributes: BoundedAttri
413413
elif is_key_present(span, AWS_SQS_QUEUE_NAME):
414414
remote_resource_type = _NORMALIZED_SQS_SERVICE_NAME + "::Queue"
415415
remote_resource_identifier = _escape_delimiters(span.attributes.get(AWS_SQS_QUEUE_NAME))
416-
cloudformation_primary_identifier = _escape_delimiters(span.attributes.get(AWS_SQS_QUEUE_URL))
416+
# If queue URL is also present, use it as the CloudFormation primary identifier
417+
if is_key_present(span, AWS_SQS_QUEUE_URL):
418+
cloudformation_primary_identifier = _escape_delimiters(span.attributes.get(AWS_SQS_QUEUE_URL))
417419
elif is_key_present(span, AWS_SQS_QUEUE_URL):
418420
remote_resource_type = _NORMALIZED_SQS_SERVICE_NAME + "::Queue"
419421
remote_resource_identifier = _escape_delimiters(

0 commit comments

Comments
 (0)