Skip to content

Commit

Permalink
feat: log the nack code in metrics
Browse files Browse the repository at this point in the history
Closes #34
  • Loading branch information
pjenvey committed Jul 19, 2018
1 parent 0e31edc commit b795566
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,21 @@ where
data,
});
}
Either::A(ClientMessage::Nack { .. }) => {
data.srv.metrics.incr("ua.command.nack").ok();
Either::A(ClientMessage::Nack { code, .. }) => {
// only metric codes expected from the client (or 0)
let mcode =
code.and_then(|code| {
if code >= 301 && code <= 303 {
Some(code)
} else {
None
}
}).unwrap_or(0);
data.srv
.metrics
.incr_with_tags("ua.command.nack")
.with_tag("code", &mcode.to_string())
.send();
webpush.stats.nacks += 1;
transition!(AwaitInput { data });
}
Expand Down

0 comments on commit b795566

Please sign in to comment.