Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce instrument logging level to debug #101

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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