Skip to content

Commit 0ce0b3f

Browse files
committed
align cfn primary id fallback behavior with java and python
1 parent f90295e commit 0ce0b3f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

aws-distro-opentelemetry-node-autoinstrumentation/src/aws-metric-attribute-generator.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,17 +501,14 @@ export class AwsMetricAttributeGenerator implements MetricAttributeGenerator {
501501
remoteResourceIdentifier = AwsMetricAttributeGenerator.getDbConnection(span);
502502
}
503503

504+
if (cloudFormationIdentifier === undefined) {
505+
cloudFormationIdentifier = remoteResourceIdentifier;
506+
}
507+
504508
if (remoteResourceType !== undefined && remoteResourceIdentifier !== undefined) {
505509
attributes[AWS_ATTRIBUTE_KEYS.AWS_REMOTE_RESOURCE_TYPE] = remoteResourceType;
506510
attributes[AWS_ATTRIBUTE_KEYS.AWS_REMOTE_RESOURCE_IDENTIFIER] = remoteResourceIdentifier;
507-
508-
if (AwsSpanProcessingUtil.isAwsSDKSpan(span)) {
509-
if (cloudFormationIdentifier === undefined) {
510-
cloudFormationIdentifier = remoteResourceIdentifier;
511-
}
512-
513-
attributes[AWS_ATTRIBUTE_KEYS.AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER] = cloudFormationIdentifier;
514-
}
511+
attributes[AWS_ATTRIBUTE_KEYS.AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER] = cloudFormationIdentifier;
515512
}
516513
}
517514

0 commit comments

Comments
 (0)