Skip to content

Commit

Permalink
Report new semconv attribute along with the old ones
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeschastny committed Oct 4, 2024
1 parent 9242179 commit fb5dee9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/middleware/aws/operations/dynamodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]);
Expand Down Expand Up @@ -64,11 +66,15 @@ macro_rules! dynamodb_table_arn_operation {
($op: ident) => {
impl DynamodbSpanBuilder {
pub fn $op<'a>(table_arn: impl Into<StringValue>) -> AwsSpanBuilder<'a> {
let table_arn = table_arn.into();
AwsSpanBuilder::dynamodb(
stringify_camel!($op),
std::iter::empty::<StringValue>(),
)
.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),
])
}
}
};
Expand Down
1 change: 1 addition & 0 deletions src/middleware/aws/operations/firehose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions src/middleware/aws/operations/sns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit fb5dee9

Please sign in to comment.