Skip to content

Commit d7cd21f

Browse files
committed
Drop the extraneous total_* fields
The values in the `total_*` counters are manipulated identically to the other fields, so we can drop them now.
1 parent 6905040 commit d7cd21f

File tree

2 files changed

+6
-33
lines changed

2 files changed

+6
-33
lines changed

lib/vector-buffers/src/buffer_usage_data.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ fn update_counter(counter: &AtomicU64, delta: u64) {
2727
struct CategorySnapshot {
2828
event_count: u64,
2929
event_byte_size: u64,
30-
total_count: u64,
31-
total_byte_size: u64,
3230
}
3331

3432
impl CategorySnapshot {
@@ -48,17 +46,13 @@ impl CategorySnapshot {
4846
struct CategoryMetrics {
4947
event_count: AtomicU64,
5048
event_byte_size: AtomicU64,
51-
total_count: AtomicU64,
52-
total_byte_size: AtomicU64,
5349
}
5450

5551
impl CategoryMetrics {
5652
/// Increments the event count and byte size by the given amounts.
5753
fn increment(&self, event_count: u64, event_byte_size: u64) {
5854
update_counter(&self.event_count, event_count);
5955
update_counter(&self.event_byte_size, event_byte_size);
60-
update_counter(&self.total_count, event_count);
61-
update_counter(&self.total_byte_size, event_byte_size);
6256
}
6357

6458
/// Sets the event count and event byte size to the given amount.
@@ -68,18 +62,13 @@ impl CategoryMetrics {
6862
self.event_count.store(event_count, Ordering::Release);
6963
self.event_byte_size
7064
.store(event_byte_size, Ordering::Release);
71-
self.total_count.store(event_count, Ordering::Release);
72-
self.total_byte_size
73-
.store(event_byte_size, Ordering::Release);
7465
}
7566

7667
/// Gets a snapshot of the event count and event byte size.
7768
fn get(&self) -> CategorySnapshot {
7869
CategorySnapshot {
7970
event_count: self.event_count.load(Ordering::Acquire),
8071
event_byte_size: self.event_byte_size.load(Ordering::Acquire),
81-
total_count: self.total_count.load(Ordering::Acquire),
82-
total_byte_size: self.total_byte_size.load(Ordering::Acquire),
8372
}
8473
}
8574

@@ -93,8 +82,6 @@ impl CategoryMetrics {
9382
CategorySnapshot {
9483
event_count: self.event_count.swap(0, Ordering::AcqRel),
9584
event_byte_size: self.event_byte_size.swap(0, Ordering::AcqRel),
96-
total_count: self.total_count.swap(0, Ordering::AcqRel),
97-
total_byte_size: self.total_byte_size.swap(0, Ordering::AcqRel),
9885
}
9986
}
10087
}
@@ -291,8 +278,6 @@ impl BufferUsage {
291278
idx: stage.idx,
292279
count: received.event_count,
293280
byte_size: received.event_byte_size,
294-
total_count: received.total_count,
295-
total_byte_size: received.total_byte_size,
296281
});
297282
}
298283

@@ -303,8 +288,6 @@ impl BufferUsage {
303288
idx: stage.idx,
304289
count: sent.event_count,
305290
byte_size: sent.event_byte_size,
306-
total_count: sent.total_count,
307-
total_byte_size: sent.total_byte_size,
308291
});
309292
}
310293

@@ -317,8 +300,6 @@ impl BufferUsage {
317300
reason: "corrupted_events",
318301
count: dropped.event_count,
319302
byte_size: dropped.event_byte_size,
320-
total_count: dropped.total_count,
321-
total_byte_size: dropped.total_byte_size,
322303
});
323304
}
324305

@@ -331,8 +312,6 @@ impl BufferUsage {
331312
reason: "drop_newest",
332313
count: dropped_intentional.event_count,
333314
byte_size: dropped_intentional.event_byte_size,
334-
total_count: dropped_intentional.total_count,
335-
total_byte_size: dropped_intentional.total_byte_size,
336315
});
337316
}
338317
}

lib/vector-buffers/src/internal_events.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ pub struct BufferEventsReceived {
5050
pub idx: usize,
5151
pub count: u64,
5252
pub byte_size: u64,
53-
pub total_count: u64,
54-
pub total_byte_size: u64,
5553
}
5654

5755
impl InternalEvent for BufferEventsReceived {
@@ -74,13 +72,13 @@ impl InternalEvent for BufferEventsReceived {
7472
"buffer_id" => self.buffer_id.clone(),
7573
"stage" => self.idx.to_string()
7674
)
77-
.set(u64_to_f64_safe(self.total_count));
75+
.set(u64_to_f64_safe(self.count));
7876
gauge!(
7977
"buffer_byte_size",
8078
"buffer_id" => self.buffer_id,
8179
"stage" => self.idx.to_string()
8280
)
83-
.set(u64_to_f64_safe(self.total_byte_size));
81+
.set(u64_to_f64_safe(self.byte_size));
8482
}
8583
}
8684

@@ -89,8 +87,6 @@ pub struct BufferEventsSent {
8987
pub idx: usize,
9088
pub count: u64,
9189
pub byte_size: u64,
92-
pub total_count: u64,
93-
pub total_byte_size: u64,
9490
}
9591

9692
impl InternalEvent for BufferEventsSent {
@@ -111,13 +107,13 @@ impl InternalEvent for BufferEventsSent {
111107
"buffer_id" => self.buffer_id.clone(),
112108
"stage" => self.idx.to_string()
113109
)
114-
.set(u64_to_f64_safe(self.total_count));
110+
.set(u64_to_f64_safe(self.count));
115111
gauge!(
116112
"buffer_byte_size",
117113
"buffer_id" => self.buffer_id,
118114
"stage" => self.idx.to_string()
119115
)
120-
.set(u64_to_f64_safe(self.total_byte_size));
116+
.set(u64_to_f64_safe(self.byte_size));
121117
}
122118
}
123119

@@ -126,8 +122,6 @@ pub struct BufferEventsDropped {
126122
pub idx: usize,
127123
pub count: u64,
128124
pub byte_size: u64,
129-
pub total_count: u64,
130-
pub total_byte_size: u64,
131125
pub intentional: bool,
132126
pub reason: &'static str,
133127
}
@@ -168,13 +162,13 @@ impl InternalEvent for BufferEventsDropped {
168162
"buffer_id" => self.buffer_id.clone(),
169163
"stage" => self.idx.to_string()
170164
)
171-
.set(u64_to_f64_safe(self.total_count));
165+
.set(u64_to_f64_safe(self.count));
172166
gauge!(
173167
"buffer_byte_size",
174168
"buffer_id" => self.buffer_id,
175169
"stage" => self.idx.to_string()
176170
)
177-
.set(u64_to_f64_safe(self.total_byte_size));
171+
.set(u64_to_f64_safe(self.byte_size));
178172
}
179173
}
180174

0 commit comments

Comments
 (0)