Skip to content

Commit 415bf1d

Browse files
committed
add support for stateMachineArn and activityArn from Step Functions service
1 parent 27b6c2b commit 415bf1d

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
@@ -49,6 +49,8 @@ internal sealed class AwsAttributeKeys
4949
internal static readonly string AttributeAWSS3Bucket = "aws.s3.bucket";
5050
internal static readonly string AttributeAWSSecretsManagerSecretArn = "aws.secretsmanager.secret.arn";
5151
internal static readonly string AttributeAWSSNSTopicArn = "aws.sns.topic.arn";
52+
internal static readonly string AttributeAWSStepFunctionsActivityArn = "aws.stepfunctions.activity.arn";
53+
internal static readonly string AttributeAWSStepFunctionsStateMachineArn = "aws.stepfunctions.state_machine.arn";
5254

5355
internal static readonly string AttributeAWSBedrockGuardrailId = "aws.bedrock.guardrail.id";
5456
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
@@ -45,6 +45,7 @@ internal class AwsMetricAttributeGenerator : IMetricAttributeGenerator
4545
private static readonly string NormalizedSecretsManagerServiceName = "AWS::SecretsManager";
4646
private static readonly string NormalizedSNSServiceName = "AWS::SNS";
4747
private static readonly string NormalizedSQSServiceName = "AWS::SQS";
48+
private static readonly string NormalizedStepFunctionsName = "AWS::StepFunctions";
4849
private static readonly string NormalizedBedrockServiceName = "AWS::Bedrock";
4950
private static readonly string NormalizedBedrockRuntimeServiceName = "AWS::BedrockRuntime";
5051
private static readonly string DbConnectionResourceType = "DB::Connection";
@@ -373,6 +374,8 @@ private static string NormalizeRemoteServiceName(Activity span, string serviceNa
373374
case "AmazonSQS": // AWS SDK v1
374375
case "Sqs": // AWS SDK v2
375376
return NormalizedSQSServiceName;
377+
case "SFN":
378+
return NormalizedStepFunctionsName;
376379
case "Bedrock":
377380
case "Bedrock Agent":
378381
case "Bedrock Agent Runtime":
@@ -431,6 +434,16 @@ private static void SetRemoteResourceTypeAndIdentifier(Activity span, ActivityTa
431434
remoteResourceType = NormalizedSQSServiceName + "::Queue";
432435
remoteResourceIdentifier = EscapeDelimiters(GetQueueName((string?)span.GetTagItem(AttributeAWSSQSQueueUrl)));
433436
}
437+
else if (IsKeyPresent(span, AttributeAWSStepFunctionsActivityArn))
438+
{
439+
remoteResourceType = NormalizedStepFunctionsName + "::Activity";
440+
remoteResourceIdentifier = EscapeDelimiters((string?)span.GetTagItem(AttributeAWSStepFunctionsActivityArn));
441+
}
442+
else if (IsKeyPresent(span, AttributeAWSStepFunctionsStateMachineArn))
443+
{
444+
remoteResourceType = NormalizedStepFunctionsName + "::StateMachine";
445+
remoteResourceIdentifier = EscapeDelimiters((string?)span.GetTagItem(AttributeAWSStepFunctionsStateMachineArn));
446+
}
434447
else if (IsKeyPresent(span, AttributeAWSBedrockGuardrailId))
435448
{
436449
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" } },
@@ -35,6 +36,8 @@ internal class AWSServiceHelper
3536
{ "StreamName", AWSSemanticConventions.AttributeAWSKinesisStreamName },
3637
{ "TopicArn", AWSSemanticConventions.AttributeAWSSnsTopicArn },
3738
{ "ARN", AWSSemanticConventions.AttributeAWSSecretsManagerSecretArn },
39+
{ "ActivityArn", AWSSemanticConventions.AttributeAWSStepFunctionsActivityArn },
40+
{ "StateMachineArn", AWSSemanticConventions.AttributeAWSStepFunctionsStateMachineArn },
3841
{ "ModelId", AWSSemanticConventions.AttributeGenAiModelId },
3942
{ "GuardrailId", AWSSemanticConventions.AttributeAWSBedrockGuardrailId },
4043
{ "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)