Skip to content

Commit

Permalink
feat: add token type to Tokenserver log lines (#1445)
Browse files Browse the repository at this point in the history
Closes #1444
  • Loading branch information
ethowitz authored Dec 2, 2022
1 parent b95e549 commit 0362bca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions syncserver/src/tokenserver/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ impl FromRequest for AuthData {
let token = Token::extract(&req).await?;

let TokenserverMetrics(mut metrics) = TokenserverMetrics::extract(&req).await?;
let mut log_items_mutator = LogItemsMutator::from(&req);

// The Python Tokenserver treats zero values and null values both as being
// null, so for consistency, we need to convert a `Some(0)` value to `None`
Expand All @@ -453,6 +454,7 @@ impl FromRequest for AuthData {
Token::BrowserIdAssertion(assertion) => {
// Add a tag to the request extensions
req.add_tag("token_type".to_owned(), "BrowserID".to_owned());
log_items_mutator.insert("token_type".to_owned(), "BrowserID".to_owned());

// Start a timer with the same tag
let mut tags = HashMap::default();
Expand Down Expand Up @@ -482,6 +484,7 @@ impl FromRequest for AuthData {
Token::OAuthToken(token) => {
// Add a tag to the request extensions
req.add_tag("token_type".to_owned(), "OAuth".to_owned());
log_items_mutator.insert("token_type".to_owned(), "OAuth".to_owned());

// Start a timer with the same tag
let mut tags = HashMap::default();
Expand Down

0 comments on commit 0362bca

Please sign in to comment.