Skip to content

Commit

Permalink
Reduce instrument logging level to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingAnarchy authored and djc committed Feb 5, 2024
1 parent 03ff8fc commit e97527a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/authentication_manager.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use async_trait::async_trait;
use tokio::sync::Mutex;
use tracing::{instrument, Level};

use crate::custom_service_account::CustomServiceAccount;
use crate::default_authorized_user::ConfigDefaultCredentials;
Expand Down Expand Up @@ -40,7 +41,7 @@ impl AuthenticationManager {
/// if it succeeds, use the default service account as the token source.
/// 4. Check if the `gcloud` tool is available on the `PATH`; if so, use the
/// `gcloud auth print-access-token` command as the token source.
#[tracing::instrument]
#[instrument(level = Level::DEBUG)]
pub async fn new() -> Result<Self, Error> {
tracing::debug!("Initializing gcp_auth");
if let Some(service_account) = CustomServiceAccount::from_env()? {
Expand Down
3 changes: 2 additions & 1 deletion src/custom_service_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::sync::RwLock;

use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use tracing::{instrument, Level};

use crate::authentication_manager::ServiceAccount;
use crate::error::Error;
Expand Down Expand Up @@ -92,7 +93,7 @@ impl ServiceAccount for CustomServiceAccount {
self.tokens.read().unwrap().get(&key).cloned()
}

#[tracing::instrument]
#[instrument(level = Level::DEBUG)]
async fn refresh_token(&self, client: &HyperClient, scopes: &[&str]) -> Result<Token, Error> {
use crate::jwt::Claims;
use crate::jwt::GRANT_TYPE;
Expand Down
3 changes: 2 additions & 1 deletion src/default_authorized_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use async_trait::async_trait;
use hyper::body::Body;
use hyper::{Method, Request};
use serde::{Deserialize, Serialize};
use tracing::{instrument, Level};

use crate::authentication_manager::ServiceAccount;
use crate::error::Error;
Expand Down Expand Up @@ -46,7 +47,7 @@ impl ConfigDefaultCredentials {
.unwrap()
}

#[tracing::instrument]
#[instrument(level = Level::DEBUG)]
async fn get_token(cred: &UserCredentials, client: &HyperClient) -> Result<Token, Error> {
let mut retries = 0;
let response = loop {
Expand Down
3 changes: 2 additions & 1 deletion src/default_service_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::sync::RwLock;
use async_trait::async_trait;
use hyper::body::Body;
use hyper::{Method, Request};
use tracing::{instrument, Level};

use crate::authentication_manager::ServiceAccount;
use crate::error::Error;
Expand Down Expand Up @@ -34,7 +35,7 @@ impl MetadataServiceAccount {
.unwrap()
}

#[tracing::instrument]
#[instrument(level = Level::DEBUG)]
async fn get_token(client: &HyperClient) -> Result<Token, Error> {
let mut retries = 0;
tracing::debug!("Getting token from GCP instance metadata server");
Expand Down

0 comments on commit e97527a

Please sign in to comment.