From fb5dee944d8acccb389cfb4a317bdc8204fd2df6 Mon Sep 17 00:00:00 2001 From: Leonid Beschastny Date: Fri, 4 Oct 2024 15:07:31 +0200 Subject: [PATCH] Report new semconv attribute along with the old ones --- src/middleware/aws/operations/dynamodb.rs | 8 +++++++- src/middleware/aws/operations/firehose.rs | 1 + src/middleware/aws/operations/sns.rs | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/middleware/aws/operations/dynamodb.rs b/src/middleware/aws/operations/dynamodb.rs index 82cae90..551f080 100644 --- a/src/middleware/aws/operations/dynamodb.rs +++ b/src/middleware/aws/operations/dynamodb.rs @@ -14,12 +14,14 @@ impl<'a> AwsSpanBuilder<'a> { table_names.into_iter().map(|item| item.into()).collect(); let mut attributes = vec![ KeyValue::new(semconv::DB_SYSTEM, "dynamodb"), + KeyValue::new(semconv::DB_OPERATION_NAME, method.clone()), KeyValue::new(semconv::legacy::DB_OPERATION, method.clone()), ]; match table_names.len() { 0 => {} 1 => { attributes.extend([ + KeyValue::new(semconv::DB_NAMESPACE, table_names[0].clone()), KeyValue::new(semconv::legacy::DB_NAME, table_names[0].clone()), Key::new(semconv::AWS_DYNAMODB_TABLE_NAMES).array(table_names), ]); @@ -64,11 +66,15 @@ macro_rules! dynamodb_table_arn_operation { ($op: ident) => { impl DynamodbSpanBuilder { pub fn $op<'a>(table_arn: impl Into) -> AwsSpanBuilder<'a> { + let table_arn = table_arn.into(); AwsSpanBuilder::dynamodb( stringify_camel!($op), std::iter::empty::(), ) - .attribute(KeyValue::new(semconv::legacy::DB_NAME, table_arn.into())) + .attributes(vec![ + KeyValue::new(semconv::DB_NAMESPACE, table_arn.clone()), + KeyValue::new(semconv::legacy::DB_NAME, table_arn), + ]) } } }; diff --git a/src/middleware/aws/operations/firehose.rs b/src/middleware/aws/operations/firehose.rs index 254a4d3..a3680c6 100644 --- a/src/middleware/aws/operations/firehose.rs +++ b/src/middleware/aws/operations/firehose.rs @@ -12,6 +12,7 @@ impl<'a> AwsSpanBuilder<'a> { ) -> Self { let mut attributes = vec![ KeyValue::new(semconv::MESSAGING_SYSTEM, "aws_firehose"), + KeyValue::new(semconv::MESSAGING_OPERATION_TYPE, operation_kind.as_str()), KeyValue::new( semconv::legacy::MESSAGING_OPERATION, operation_kind.as_str(), diff --git a/src/middleware/aws/operations/sns.rs b/src/middleware/aws/operations/sns.rs index a80ff97..afc67f5 100644 --- a/src/middleware/aws/operations/sns.rs +++ b/src/middleware/aws/operations/sns.rs @@ -12,6 +12,7 @@ impl<'a> AwsSpanBuilder<'a> { ) -> Self { let mut attributes = vec![ KeyValue::new(semconv::MESSAGING_SYSTEM, "aws_sns"), + KeyValue::new(semconv::MESSAGING_OPERATION_TYPE, operation_kind.as_str()), KeyValue::new( semconv::legacy::MESSAGING_OPERATION, operation_kind.as_str(),