Skip to content

Commit

Permalink
ref: restore Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Aug 1, 2024
1 parent fbd5aca commit 2e127ec
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion relay-metrics/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl Ord for QueuedBucket {
}
}

#[derive(Default, Debug)]
#[derive(Default)]
struct CostTracker {
total_cost: usize,
cost_per_project_key: HashMap<ProjectKey, usize>,
Expand Down Expand Up @@ -453,6 +453,20 @@ impl CostTracker {
}
}

impl fmt::Debug for CostTracker {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("CostTracker")
.field("total_cost", &self.total_cost)
// Convert HashMap to BTreeMap to guarantee order:
.field(
"cost_per_project_key",
&BTreeMap::from_iter(self.cost_per_project_key.iter()),
)
.field("cost_per_namespace", &self.cost_per_namespace)
.finish()
}
}

/// Returns the instant at which a bucket should be flushed.
///
/// All buckets are flushed after a grace period of `initial_delay`.
Expand Down

0 comments on commit 2e127ec

Please sign in to comment.