Skip to content

Commit cb31105

Browse files
authored
feat: Add auto-instrumentation support for Step Functions, SNS, Secre… (#899)
### *Description of changes:* Changes in ADOT package to support new AWS resources in Java V1 & V2 SDKs. Related changes for V1 SDK in upstream package: mxiamxia/opentelemetry-java-instrumentation#11 Related changes for V2 SDK in upstream package: mxiamxia/opentelemetry-java-instrumentation#12 These changes add auto-instrumentation support for the following AWS resources. Additionally, a new attribute for `aws.remote.resource.cfn.primary.identifier` is also added for each new resource. - Populate `aws.sns.topic.arn` in Span by extracting `TopicArn` from the request body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html - The CFN Id should be the ARN of the Topic. - Populate `aws.secretsmanager.secret.arn` in Span by extracting `ARN` from response body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-secretsmanager-secret.html - The CFN Id should be the ARN of the Secret. - Populate `aws.stepfunctions.state_machine.arn` in Span by extracting `stateMachineArn` from the request body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html - The CFN Id should be the ARN of the State Machine. - Populate `aws.stepfunctions.activity.arn` in Span by extracting `activityArn` from the request body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-activity.html - The CFN Id should be the ARN of the Activity. - Populate `aws.lambda.function.name` in Span by extracting `FunctionName` from the request body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html - The CFN Id should be the ARN of the Lambda Function. - Populate `aws.lambda.resource_mapping.id` in Span by extracting `UUID` from the request body. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html - The CFN Id should be the UUID of the Event Source Mapping. ### *Test Plan:* Set up a client-server with auto-instrumentation to verify that the correct span data is being generated. Note: V1 span data is top pic and V2 span data is bottom pic for each resource. `aws.lambda.function.name` <img width="1512" alt="lambda-function-name-span-data-verification-v1" src="https://github.com/user-attachments/assets/ecc6780e-546b-4776-a916-16cac97863ec"> <img width="1512" alt="lambda-function-name-span-data-verification-v2" src="https://github.com/user-attachments/assets/eb4d288d-dbb4-4dd1-9562-abea8ec91937"> `aws.lambda.resource_mapping.id` <img width="1512" alt="lambda-resource-mapping-id-span-data-verification-v1" src="https://github.com/user-attachments/assets/5059000a-ef5a-4eec-a0d8-e2e63c144ff3"> <img width="1512" alt="lambda-resource-mapping-id-span-data-verification-v2" src="https://github.com/user-attachments/assets/54fea71d-05bc-40ac-98b8-5e4d49b0d391"> `aws.secretsmanager.secret.arn` <img width="1512" alt="secretsmanager-secret-arn-span-data-verification-v1" src="https://github.com/user-attachments/assets/e0cf9fcb-1d99-4ed9-bf33-f9e04c4ad352"> <img width="1512" alt="secretsmanager-secret-arn-span-data-verification-v2" src="https://github.com/user-attachments/assets/2db81495-d8a7-43cf-a616-4cbe6bd3d3f8"> `aws.sns.topic.arn` <img width="1512" alt="sns-topic-arn-span-data-verification-v1" src="https://github.com/user-attachments/assets/cc000f1f-ded7-4d02-98e6-545583f47e5e"> <img width="1512" alt="sns-topic-arn-span-data-verification-v2" src="https://github.com/user-attachments/assets/666fcfd2-045a-4a0a-a5c2-662bcaa60e41"> `aws.stepfunctions.activity.arn` <img width="1512" alt="stepfunctions-activity-arn-span-data-verification-v1" src="https://github.com/user-attachments/assets/e3ade244-eb1e-4f5c-9878-5c78ee4f2a32"> <img width="1512" alt="sfn-activity-arn-span-data-verification-v2" src="https://github.com/user-attachments/assets/89814a71-bbac-4026-b4e1-591f767e3a13"> `aws.stepfunction.state_machine.arn` <img width="1512" alt="stepfunctions-state-machine-arn-span-data-verification-v1" src="https://github.com/user-attachments/assets/91670d86-a726-472a-8f0f-b156cd68ef63"> <img width="1512" alt="sfn-state-machine-arn-span-data-verification-v2" src="https://github.com/user-attachments/assets/70f59b80-af4c-400d-84e5-35fd06eef20e"> Metric Attribute Generator Unit Test <img width="1512" alt="Screenshot 2024-10-02 at 2 59 35 PM" src="https://github.com/user-attachments/assets/fadf5ec5-dba3-46a4-abdd-d8cd9ab56cc5"> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 47ce3b1 commit cb31105

File tree

4 files changed

+163
-0
lines changed

4 files changed

+163
-0
lines changed

awsagentprovider/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ dependencies {
3636
implementation("io.opentelemetry.contrib:opentelemetry-aws-resources")
3737
// Json file reader
3838
implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1")
39+
// Import AWS SDK v1 core for ARN parsing utilities
40+
implementation("com.amazonaws:aws-java-sdk-core:1.12.773")
3941
// Export configuration
4042
compileOnly("io.opentelemetry:opentelemetry-exporter-otlp")
4143

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsAttributeKeys.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ private AwsAttributeKeys() {}
3838
static final AttributeKey<String> AWS_REMOTE_RESOURCE_IDENTIFIER =
3939
AttributeKey.stringKey("aws.remote.resource.identifier");
4040

41+
static final AttributeKey<String> AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER =
42+
AttributeKey.stringKey("aws.remote.resource.cfn.primary.identifier");
43+
4144
static final AttributeKey<String> AWS_REMOTE_RESOURCE_TYPE =
4245
AttributeKey.stringKey("aws.remote.resource.type");
4346

@@ -50,6 +53,26 @@ private AwsAttributeKeys() {}
5053
static final AttributeKey<String> AWS_CONSUMER_PARENT_SPAN_KIND =
5154
AttributeKey.stringKey("aws.consumer.parent.span.kind");
5255

56+
static final AttributeKey<String> AWS_STATE_MACHINE_ARN =
57+
AttributeKey.stringKey("aws.stepfunctions.state_machine.arn");
58+
59+
static final AttributeKey<String> AWS_STEP_FUNCTIONS_ACTIVITY_ARN =
60+
AttributeKey.stringKey("aws.stepfunctions.activity.arn");
61+
62+
static final AttributeKey<String> AWS_SNS_TOPIC_ARN = AttributeKey.stringKey("aws.sns.topic.arn");
63+
64+
static final AttributeKey<String> AWS_SECRET_ARN =
65+
AttributeKey.stringKey("aws.secretsmanager.secret.arn");
66+
67+
static final AttributeKey<String> AWS_LAMBDA_NAME =
68+
AttributeKey.stringKey("aws.lambda.function.name");
69+
70+
static final AttributeKey<String> AWS_LAMBDA_ARN =
71+
AttributeKey.stringKey("aws.lambda.function.arn");
72+
73+
static final AttributeKey<String> AWS_LAMBDA_RESOURCE_ID =
74+
AttributeKey.stringKey("aws.lambda.resource_mapping.id");
75+
5376
// use the same AWS Resource attribute name defined by OTel java auto-instr for aws_sdk_v_1_1
5477
// TODO: all AWS specific attributes should be defined in semconv package and reused cross all
5578
// otel packages. Related sim -

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGenerator.java

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
4343
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_AGENT_ID;
4444
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_BUCKET_NAME;
45+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER;
4546
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATA_SOURCE_ID;
4647
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
4748
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGE_BASE_ID;
49+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LAMBDA_NAME;
50+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LAMBDA_RESOURCE_ID;
4851
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_OPERATION;
4952
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE;
5053
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_QUEUE_NAME;
@@ -54,7 +57,11 @@
5457
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_RESOURCE_IDENTIFIER;
5558
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_RESOURCE_TYPE;
5659
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_SERVICE;
60+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SECRET_ARN;
61+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SNS_TOPIC_ARN;
5762
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SPAN_KIND;
63+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STATE_MACHINE_ARN;
64+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STEP_FUNCTIONS_ACTIVITY_ARN;
5865
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STREAM_NAME;
5966
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_TABLE_NAME;
6067
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
@@ -67,6 +74,7 @@
6774
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isDBSpan;
6875
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.isKeyPresent;
6976

77+
import com.amazonaws.arn.Arn;
7078
import io.opentelemetry.api.common.AttributeKey;
7179
import io.opentelemetry.api.common.Attributes;
7280
import io.opentelemetry.api.common.AttributesBuilder;
@@ -111,6 +119,10 @@ final class AwsMetricAttributeGenerator implements MetricAttributeGenerator {
111119
private static final String NORMALIZED_SQS_SERVICE_NAME = "AWS::SQS";
112120
private static final String NORMALIZED_BEDROCK_SERVICE_NAME = "AWS::Bedrock";
113121
private static final String NORMALIZED_BEDROCK_RUNTIME_SERVICE_NAME = "AWS::BedrockRuntime";
122+
private static final String NORMALIZED_STEPFUNCTIONS_SERVICE_NAME = "AWS::StepFunctions";
123+
private static final String NORMALIZED_SNS_SERVICE_NAME = "AWS::SNS";
124+
private static final String NORMALIZED_SECRETSMANAGER_SERVICE_NAME = "AWS::SecretsManager";
125+
private static final String NORMALIZED_LAMBDA_SERVICE_NAME = "AWS::Lambda";
114126

115127
// Special DEPENDENCY attribute value if GRAPHQL_OPERATION_TYPE attribute key is present.
116128
private static final String GRAPHQL = "graphql";
@@ -371,6 +383,18 @@ private static String normalizeRemoteServiceName(SpanData span, String serviceNa
371383
case "AmazonBedrockRuntime": // AWS SDK v1
372384
case "BedrockRuntime": // AWS SDK v2
373385
return NORMALIZED_BEDROCK_RUNTIME_SERVICE_NAME;
386+
case "AWSStepFunctions": // AWS SDK v1
387+
case "Sfn": // AWS SDK v2
388+
return NORMALIZED_STEPFUNCTIONS_SERVICE_NAME;
389+
case "AmazonSNS":
390+
case "Sns":
391+
return NORMALIZED_SNS_SERVICE_NAME;
392+
case "AWSSecretsManager": // AWS SDK v1
393+
case "SecretsManager": // AWS SDK v2
394+
return NORMALIZED_SECRETSMANAGER_SERVICE_NAME;
395+
case "AWSLambda": // AWS SDK v1
396+
case "Lambda": // AWS SDK v2
397+
return NORMALIZED_LAMBDA_SERVICE_NAME;
374398
default:
375399
return "AWS::" + serviceName;
376400
}
@@ -392,6 +416,7 @@ private static String normalizeRemoteServiceName(SpanData span, String serviceNa
392416
private static void setRemoteResourceTypeAndIdentifier(SpanData span, AttributesBuilder builder) {
393417
Optional<String> remoteResourceType = Optional.empty();
394418
Optional<String> remoteResourceIdentifier = Optional.empty();
419+
Optional<String> cloudformationPrimaryIdentifier = Optional.empty();
395420

396421
if (isAwsSDKSpan(span)) {
397422
if (isKeyPresent(span, AWS_TABLE_NAME)) {
@@ -434,18 +459,88 @@ private static void setRemoteResourceTypeAndIdentifier(SpanData span, Attributes
434459
remoteResourceType = Optional.of(NORMALIZED_BEDROCK_SERVICE_NAME + "::Model");
435460
remoteResourceIdentifier =
436461
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(GEN_AI_REQUEST_MODEL)));
462+
} else if (isKeyPresent(span, AWS_STATE_MACHINE_ARN)) {
463+
remoteResourceType = Optional.of(NORMALIZED_STEPFUNCTIONS_SERVICE_NAME + "::StateMachine");
464+
remoteResourceIdentifier =
465+
getSfnResourceNameFromArn(
466+
Optional.ofNullable(
467+
escapeDelimiters(span.getAttributes().get(AWS_STATE_MACHINE_ARN))));
468+
cloudformationPrimaryIdentifier =
469+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_STATE_MACHINE_ARN)));
470+
} else if (isKeyPresent(span, AWS_STEP_FUNCTIONS_ACTIVITY_ARN)) {
471+
remoteResourceType = Optional.of(NORMALIZED_STEPFUNCTIONS_SERVICE_NAME + "::Activity");
472+
remoteResourceIdentifier =
473+
getSfnResourceNameFromArn(
474+
Optional.ofNullable(
475+
escapeDelimiters(span.getAttributes().get(AWS_STEP_FUNCTIONS_ACTIVITY_ARN))));
476+
cloudformationPrimaryIdentifier =
477+
Optional.ofNullable(
478+
escapeDelimiters(span.getAttributes().get(AWS_STEP_FUNCTIONS_ACTIVITY_ARN)));
479+
} else if (isKeyPresent(span, AWS_SNS_TOPIC_ARN)) {
480+
remoteResourceType = Optional.of(NORMALIZED_SNS_SERVICE_NAME + "::Topic");
481+
remoteResourceIdentifier =
482+
getSnsResourceNameFromArn(
483+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_SNS_TOPIC_ARN))));
484+
cloudformationPrimaryIdentifier =
485+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_SNS_TOPIC_ARN)));
486+
} else if (isKeyPresent(span, AWS_SECRET_ARN)) {
487+
remoteResourceType = Optional.of(NORMALIZED_SECRETSMANAGER_SERVICE_NAME + "::Secret");
488+
remoteResourceIdentifier =
489+
getSecretsManagerResourceNameFromArn(
490+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_SECRET_ARN))));
491+
cloudformationPrimaryIdentifier =
492+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_SECRET_ARN)));
493+
} else if (isKeyPresent(span, AWS_LAMBDA_NAME)) {
494+
remoteResourceType = Optional.of(NORMALIZED_LAMBDA_SERVICE_NAME + "::Function");
495+
remoteResourceIdentifier =
496+
getLambdaResourceNameFromAribitraryName(
497+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_LAMBDA_NAME))));
498+
} else if (isKeyPresent(span, AWS_LAMBDA_RESOURCE_ID)) {
499+
remoteResourceType = Optional.of(NORMALIZED_LAMBDA_SERVICE_NAME + "::EventSourceMapping");
500+
remoteResourceIdentifier =
501+
Optional.ofNullable(escapeDelimiters(span.getAttributes().get(AWS_LAMBDA_RESOURCE_ID)));
437502
}
438503
} else if (isDBSpan(span)) {
439504
remoteResourceType = Optional.of(DB_CONNECTION_RESOURCE_TYPE);
440505
remoteResourceIdentifier = getDbConnection(span);
441506
}
442507

508+
if (cloudformationPrimaryIdentifier.isEmpty()) {
509+
cloudformationPrimaryIdentifier = remoteResourceIdentifier;
510+
}
511+
443512
if (remoteResourceType.isPresent() && remoteResourceIdentifier.isPresent()) {
444513
builder.put(AWS_REMOTE_RESOURCE_TYPE, remoteResourceType.get());
445514
builder.put(AWS_REMOTE_RESOURCE_IDENTIFIER, remoteResourceIdentifier.get());
515+
builder.put(AWS_CLOUDFORMATION_PRIMARY_IDENTIFIER, cloudformationPrimaryIdentifier.get());
446516
}
447517
}
448518

519+
// NOTE: "name" in this case can be either the lambda name or lambda arn
520+
private static Optional<String> getLambdaResourceNameFromAribitraryName(
521+
Optional<String> arbitraryName) {
522+
if (arbitraryName != null && arbitraryName.get().startsWith("arn:aws:lambda:")) {
523+
Arn resourceArn = Arn.fromString(arbitraryName.get());
524+
return Optional.of(resourceArn.getResource().toString().split(":")[1]);
525+
}
526+
return arbitraryName;
527+
}
528+
529+
private static Optional<String> getSecretsManagerResourceNameFromArn(Optional<String> stringArn) {
530+
Arn resourceArn = Arn.fromString(stringArn.get());
531+
return Optional.of(resourceArn.getResource().toString().split(":")[1]);
532+
}
533+
534+
private static Optional<String> getSfnResourceNameFromArn(Optional<String> stringArn) {
535+
Arn resourceArn = Arn.fromString(stringArn.get());
536+
return Optional.of(resourceArn.getResource().toString().split(":")[1]);
537+
}
538+
539+
private static Optional<String> getSnsResourceNameFromArn(Optional<String> stringArn) {
540+
Arn resourceArn = Arn.fromString(stringArn.get());
541+
return Optional.of(resourceArn.getResource().toString());
542+
}
543+
449544
/**
450545
* RemoteResourceIdentifier is populated with rule <code>
451546
* ^[{db.name}|]?{address}[|{port}]?

awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_DATA_SOURCE_ID;
2727
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_GUARDRAIL_ID;
2828
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_KNOWLEDGE_BASE_ID;
29+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LAMBDA_NAME;
30+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LAMBDA_RESOURCE_ID;
2931
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_OPERATION;
3032
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_LOCAL_SERVICE;
3133
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_QUEUE_NAME;
@@ -35,7 +37,11 @@
3537
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_RESOURCE_IDENTIFIER;
3638
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_RESOURCE_TYPE;
3739
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_REMOTE_SERVICE;
40+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SECRET_ARN;
41+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SNS_TOPIC_ARN;
3842
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_SPAN_KIND;
43+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STATE_MACHINE_ARN;
44+
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STEP_FUNCTIONS_ACTIVITY_ARN;
3945
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_STREAM_NAME;
4046
import static software.amazon.opentelemetry.javaagent.providers.AwsAttributeKeys.AWS_TABLE_NAME;
4147
import static software.amazon.opentelemetry.javaagent.providers.AwsSpanProcessingUtil.GEN_AI_REQUEST_MODEL;
@@ -770,6 +776,42 @@ public void testSdkClientSpanWithRemoteResourceAttributes() {
770776
mockAttribute(GEN_AI_REQUEST_MODEL, "test.service_^id");
771777
validateRemoteResourceAttributes("AWS::Bedrock::Model", "test.service_^^id");
772778
mockAttribute(GEN_AI_REQUEST_MODEL, null);
779+
780+
// Validate behaviour of AWS_STATE_MACHINE_ARN attribute, then remove it.
781+
mockAttribute(
782+
AWS_STATE_MACHINE_ARN,
783+
"arn:aws:states:us-east-1:123456789012:stateMachine:test_state_machine");
784+
validateRemoteResourceAttributes("AWS::StepFunctions::StateMachine", "test_state_machine");
785+
mockAttribute(AWS_STATE_MACHINE_ARN, null);
786+
787+
// Validate behaviour of AWS_STEPFUNCTIONS_ACTIVITY_ARN, then remove it.
788+
mockAttribute(
789+
AWS_STEP_FUNCTIONS_ACTIVITY_ARN,
790+
"arn:aws:states:us-east-1:007003123456789012:activity:testActivity");
791+
validateRemoteResourceAttributes("AWS::StepFunctions::Activity", "testActivity");
792+
mockAttribute(AWS_STEP_FUNCTIONS_ACTIVITY_ARN, null);
793+
794+
// Validate behaviour of AWS_SNS_TOPIC_ARN, then remove it.
795+
mockAttribute(AWS_SNS_TOPIC_ARN, "arn:aws:sns:us-west-2:012345678901:testTopic");
796+
validateRemoteResourceAttributes("AWS::SNS::Topic", "testTopic");
797+
mockAttribute(AWS_SNS_TOPIC_ARN, null);
798+
799+
// Validate behaviour of AWS_SECRET_ARN, then remove it.
800+
mockAttribute(
801+
AWS_SECRET_ARN, "arn:aws:secretsmanager:us-east-1:123456789012:secret:secretName");
802+
validateRemoteResourceAttributes("AWS::SecretsManager::Secret", "secretName");
803+
mockAttribute(AWS_SECRET_ARN, null);
804+
805+
// Validate behaviour of AWS_LAMBDA_NAME, then remove it.
806+
mockAttribute(AWS_LAMBDA_NAME, "arn:aws:lambda:us-east-1:123456789012:function:functionName");
807+
validateRemoteResourceAttributes("AWS::Lambda::Function", "functionName");
808+
mockAttribute(AWS_LAMBDA_NAME, null);
809+
810+
// Validate behaviour of AWS_LAMBDA_RESOURCE_ID
811+
mockAttribute(AWS_LAMBDA_RESOURCE_ID, "eventSourceId");
812+
validateRemoteResourceAttributes("AWS::Lambda::EventSourceMapping", "eventSourceId");
813+
mockAttribute(AWS_LAMBDA_RESOURCE_ID, null);
814+
773815
mockAttribute(RPC_SYSTEM, "null");
774816
}
775817

@@ -1175,6 +1217,7 @@ public void testNormalizeRemoteServiceName_AwsSdk() {
11751217
testAwsSdkServiceNormalization("AWSBedrockAgentRuntime", "AWS::Bedrock");
11761218
testAwsSdkServiceNormalization("AWSBedrockAgent", "AWS::Bedrock");
11771219
testAwsSdkServiceNormalization("AmazonBedrockRuntime", "AWS::BedrockRuntime");
1220+
testAwsSdkServiceNormalization("AWSStepFunctions", "AWS::StepFunctions");
11781221

11791222
// AWS SDK V2
11801223
testAwsSdkServiceNormalization("DynamoDb", "AWS::DynamoDB");

0 commit comments

Comments
 (0)