Skip to content

Commit

Permalink
add: metric for occurence of misbehavior by reason
Browse files Browse the repository at this point in the history
  • Loading branch information
0xB10C committed Feb 11, 2024
1 parent f6b2675 commit d22e856
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ fn main() {
&m.xmessage,
])
.inc();
metrics::CONN_MISBEHAVING_REASON
.with_label_values(&[&m.xmessage])
.inc();
metrics::CONN_MISBEHAVING_SCORE_INC
.with_label_values(&[&m.id.to_string(), &m.xmessage])
.inc_by(m.score_increase as u64);
Expand Down
9 changes: 9 additions & 0 deletions metrics/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,15 @@ lazy_static! {
&[LABEL_CONN_MISBEHAVING_ID, LABEL_CONN_MISBEHAVING_MESSAGE]
).unwrap();

// Occurences of misbehavior by reasons.
pub static ref CONN_MISBEHAVING_REASON: IntCounterVec =
register_int_counter_vec!(
Opts::new("misbehaving_reason", "Occurences of misbehavior by reasons")
.namespace(NAMESPACE)
.subsystem(SUBSYSTEM_CONN),
&[LABEL_CONN_MISBEHAVING_MESSAGE]
).unwrap();

// -------------------- INVs

/// Number of INV entries send and received with INV type.
Expand Down

0 comments on commit d22e856

Please sign in to comment.