Skip to content

Commit a27668b

Browse files
committed
feat: Add in monitoring metrics in collect
1 parent 0211bdd commit a27668b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

agent/src/collector/collector.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ use public::{
6262
pub struct CollectorCounter {
6363
window_delay: AtomicI64,
6464
flow_delay: AtomicI64,
65+
input: AtomicU64,
6566
out: AtomicU64,
6667
drop_before_window: AtomicU64,
6768
drop_inactive: AtomicU64,
@@ -86,6 +87,11 @@ impl RefCountable for CollectorCounter {
8687
CounterType::Counted,
8788
CounterValue::Signed(self.flow_delay.swap(0, Ordering::Relaxed)),
8889
),
90+
(
91+
"in",
92+
CounterType::Counted,
93+
CounterValue::Unsigned(self.input.swap(0, Ordering::Relaxed)),
94+
),
8995
(
9096
"out",
9197
CounterType::Counted,
@@ -506,6 +512,8 @@ impl Stash {
506512
directions: &[Direction; 2],
507513
config: &CollectorConfig,
508514
) {
515+
self.counter.input.fetch_add(1, Ordering::Relaxed);
516+
509517
// edge_stats: If both ends of direction are None or not None, record the
510518
// statistical data with direction=0 (corresponding tap-side=rest)
511519
if Direction::from(directions) == Direction::None {
@@ -700,6 +708,8 @@ impl Stash {
700708
directions: &[Direction; 2],
701709
config: &CollectorConfig,
702710
) {
711+
self.counter.input.fetch_add(1, Ordering::Relaxed);
712+
703713
let flow = &meter.flow;
704714
// edge_stats: If both ends of direction are None or not None, record the
705715
// statistical data with direction=0 (corresponding tap-side=rest)

0 commit comments

Comments
 (0)