Skip to content

Commit 5a1e98a

Browse files
committed
Instrument core code paths with tracing spans
1 parent dbfdd9c commit 5a1e98a

5 files changed

+5
-0
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ thiserror = "1.0"
2929
time = { version = "0.3.5", features = ["serde"] }
3030
tokio = { version = "1.1", features = ["fs", "sync"] }
3131
tracing = "0.1.29"
32+
tracing-futures = "0.2.5"
3233
url = "2"
3334
which = "4.2"
3435

src/authentication_manager.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl AuthenticationManager {
4242
/// if it succeeds, use the default service account as the token source.
4343
/// 4. Look for credentials in `.config/gcloud/application_default_credentials.json`;
4444
/// if found, use these credentials to request refresh tokens.
45+
#[tracing::instrument]
4546
pub async fn new() -> Result<Self, Error> {
4647
tracing::debug!("Initializing gcp_auth");
4748
if let Some(service_account) = CustomServiceAccount::from_env()? {

src/custom_service_account.rs

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl ServiceAccount for CustomServiceAccount {
8686
self.tokens.read().unwrap().get(&key).cloned()
8787
}
8888

89+
#[tracing::instrument]
8990
async fn refresh_token(&self, client: &HyperClient, scopes: &[&str]) -> Result<Token, Error> {
9091
use crate::jwt::Claims;
9192
use crate::jwt::GRANT_TYPE;

src/default_authorized_user.rs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl DefaultAuthorizedUser {
3535
.unwrap()
3636
}
3737

38+
#[tracing::instrument]
3839
async fn get_token(client: &HyperClient) -> Result<Token, Error> {
3940
tracing::debug!("Loading user credentials file");
4041
let mut home = dirs_next::home_dir().ok_or(Error::NoHomeDir)?;

src/default_service_account.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl DefaultServiceAccount {
3434
.unwrap()
3535
}
3636

37+
#[tracing::instrument]
3738
async fn get_token(client: &HyperClient) -> Result<Token, Error> {
3839
tracing::debug!("Getting token from GCP instance metadata server");
3940
let req = Self::build_token_request(Self::DEFAULT_TOKEN_GCP_URI);

0 commit comments

Comments
 (0)