Skip to content

Commit

Permalink
Merge pull request #38 from mozilla-services/feat/34
Browse files Browse the repository at this point in the history
feat: log the nack code in metrics
  • Loading branch information
bbangert authored Jul 19, 2018
2 parents 0e31edc + b795566 commit de1c737
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 de1c737

Please sign in to comment.