Skip to content

Commit

Permalink
chore: use mut amount in dd
Browse files Browse the repository at this point in the history
  • Loading branch information
wikiwong committed Aug 21, 2023
1 parent acf1472 commit 090ea9d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rust/src/adapter/datadog_formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ impl Span {

pub fn add_allocation(&mut self, amount: u32) {
let key = "allocation".to_string();
let mut amount = amount;
if let Some(alloc) = self.meta.get(key.as_str()) {
if let Ok(v) = alloc.parse::<u32>() {
let sum_amount = v + amount;
self.meta.insert(key, sum_amount.to_string());
amount = v + amount;
}
} else {
self.meta.insert(key, amount.to_string());
}
self.meta.insert(key, amount.to_string());
}

pub fn add_tag(&mut self, tag: String) {
Expand Down

0 comments on commit 090ea9d

Please sign in to comment.