Skip to content

Commit 5e15aba

Browse files
committed
add support for stateMachineArn and activityArn from Step Functions service
1 parent 72f34e9 commit 5e15aba

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsAttributeKeys.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ internal sealed class AwsAttributeKeys
5151
internal static readonly string AttributeAWSS3Bucket = "aws.s3.bucket";
5252
internal static readonly string AttributeAWSSecretsManagerSecretArn = "aws.secretsmanager.secret.arn";
5353
internal static readonly string AttributeAWSSNSTopicArn = "aws.sns.topic.arn";
54+
internal static readonly string AttributeAWSStepFunctionsActivityArn = "aws.stepfunctions.activity.arn";
55+
internal static readonly string AttributeAWSStepFunctionsStateMachineArn = "aws.stepfunctions.state_machine.arn";
5456

5557
internal static readonly string AttributeAWSBedrockGuardrailId = "aws.bedrock.guardrail.id";
5658
internal static readonly string AttributeAWSBedrockAgentId = "aws.bedrock.agent.id";

src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AwsMetricAttributeGenerator.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ internal class AwsMetricAttributeGenerator : IMetricAttributeGenerator
4646
private static readonly string NormalizedSecretsManagerServiceName = "AWS::SecretsManager";
4747
private static readonly string NormalizedSNSServiceName = "AWS::SNS";
4848
private static readonly string NormalizedSQSServiceName = "AWS::SQS";
49+
private static readonly string NormalizedStepFunctionsName = "AWS::StepFunctions";
4950
private static readonly string NormalizedBedrockServiceName = "AWS::Bedrock";
5051
private static readonly string NormalizedBedrockRuntimeServiceName = "AWS::BedrockRuntime";
5152
private static readonly string DbConnectionResourceType = "DB::Connection";
@@ -374,6 +375,8 @@ private static string NormalizeRemoteServiceName(Activity span, string serviceNa
374375
case "AmazonSQS": // AWS SDK v1
375376
case "Sqs": // AWS SDK v2
376377
return NormalizedSQSServiceName;
378+
case "SFN":
379+
return NormalizedStepFunctionsName;
377380
case "Bedrock":
378381
case "Bedrock Agent":
379382
case "Bedrock Agent Runtime":
@@ -435,6 +438,16 @@ private static void SetRemoteResourceTypeAndIdentifier(Activity span, ActivityTa
435438
remoteResourceIdentifier = EscapeDelimiters(GetQueueName((string?)span.GetTagItem(AttributeAWSSQSQueueUrl)));
436439
cloudformationPrimaryIdentifier = EscapeDelimiters((string?)span.GetTagItem(AttributeAWSSQSQueueUrl));
437440
}
441+
else if (IsKeyPresent(span, AttributeAWSStepFunctionsActivityArn))
442+
{
443+
remoteResourceType = NormalizedStepFunctionsName + "::Activity";
444+
remoteResourceIdentifier = EscapeDelimiters((string?)span.GetTagItem(AttributeAWSStepFunctionsActivityArn));
445+
}
446+
else if (IsKeyPresent(span, AttributeAWSStepFunctionsStateMachineArn))
447+
{
448+
remoteResourceType = NormalizedStepFunctionsName + "::StateMachine";
449+
remoteResourceIdentifier = EscapeDelimiters((string?)span.GetTagItem(AttributeAWSStepFunctionsStateMachineArn));
450+
}
438451
else if (IsKeyPresent(span, AttributeAWSBedrockGuardrailId))
439452
{
440453
remoteResourceType = NormalizedBedrockServiceName + "::Guardrail";

src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSSemanticConventions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ internal static class AWSSemanticConventions
1717
public const string AttributeAWSKinesisStreamName = "aws.kinesis.stream_name";
1818
public const string AttributeAWSSecretsManagerSecretArn = "aws.secretsmanager.secret.arn";
1919
public const string AttributeAWSSnsTopicArn = "aws.sns.topic.arn";
20+
public const string AttributeAWSStepFunctionsActivityArn = "aws.stepfunctions.activity.arn";
21+
public const string AttributeAWSStepFunctionsStateMachineArn = "aws.stepfunctions.state_machine.arn";
2022

2123
// AWS Bedrock service attributes not yet defined in semantic conventions
2224
public const string AttributeAWSBedrockGuardrailId = "aws.bedrock.guardrail.id";

src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSServiceHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ internal class AWSServiceHelper
1414
{ AWSServiceType.S3Service, new List<string> { "BucketName" } },
1515
{ AWSServiceType.KinesisService, new List<string> { "StreamName" } },
1616
{ AWSServiceType.SNSService, new List<string> { "TopicArn" } },
17+
{ AWSServiceType.StepFunctionsService, new List<string> { "ActivityArn", "StateMachineArn" } },
1718
{ AWSServiceType.BedrockRuntimeService, new List<string> { "ModelId" } },
1819
{ AWSServiceType.BedrockAgentService, new List<string> { "AgentId", "KnowledgeBaseId", "DataSourceId" } },
1920
{ AWSServiceType.BedrockAgentRuntimeService, new List<string> { "AgentId", "KnowledgeBaseId" } },
@@ -36,6 +37,8 @@ internal class AWSServiceHelper
3637
{ "StreamName", AWSSemanticConventions.AttributeAWSKinesisStreamName },
3738
{ "TopicArn", AWSSemanticConventions.AttributeAWSSnsTopicArn },
3839
{ "ARN", AWSSemanticConventions.AttributeAWSSecretsManagerSecretArn },
40+
{ "ActivityArn", AWSSemanticConventions.AttributeAWSStepFunctionsActivityArn },
41+
{ "StateMachineArn", AWSSemanticConventions.AttributeAWSStepFunctionsStateMachineArn },
3942
{ "ModelId", AWSSemanticConventions.AttributeGenAiModelId },
4043
{ "GuardrailId", AWSSemanticConventions.AttributeAWSBedrockGuardrailId },
4144
{ "AgentId", AWSSemanticConventions.AttributeAWSBedrockAgentId },

src/OpenTelemetry.Instrumentation.AWS/Implementation/AWSServiceType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ internal class AWSServiceType
77
{
88
internal const string DynamoDbService = "DynamoDB";
99
internal const string SecretsManagerService = "Secrets Manager";
10+
internal const string StepFunctionsService = "SFN";
1011
internal const string SQSService = "SQS";
1112
internal const string SNSService = "SNS";
1213
internal const string S3Service = "S3";

0 commit comments

Comments
 (0)