Created
April 4, 2024 20:56
-
-
Save vdhanan/7695016cfd11fe849a9f43c892c4c2c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/services/identity/Cargo.lock b/services/identity/Cargo.lock | |
index 89d2064ea9..a41b1c1690 100644 | |
--- a/services/identity/Cargo.lock | |
+++ b/services/identity/Cargo.lock | |
@@ -3014,6 +3014,16 @@ dependencies = [ | |
"tracing-core", | |
] | |
+[[package]] | |
+name = "tracing-serde" | |
+version = "0.1.3" | |
+source = "registry+https://github.com/rust-lang/crates.io-index" | |
+checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" | |
+dependencies = [ | |
+ "serde", | |
+ "tracing-core", | |
+] | |
+ | |
[[package]] | |
name = "tracing-subscriber" | |
version = "0.3.18" | |
@@ -3024,12 +3034,15 @@ dependencies = [ | |
"nu-ansi-term", | |
"once_cell", | |
"regex", | |
+ "serde", | |
+ "serde_json", | |
"sharded-slab", | |
"smallvec", | |
"thread_local", | |
"tracing", | |
"tracing-core", | |
"tracing-log", | |
+ "tracing-serde", | |
] | |
[[package]] | |
diff --git a/services/identity/Cargo.toml b/services/identity/Cargo.toml | |
index 048ceafd0d..776961826d 100644 | |
--- a/services/identity/Cargo.toml | |
+++ b/services/identity/Cargo.toml | |
@@ -17,7 +17,7 @@ comm-lib = { path = "../../shared/comm-lib", features = [ | |
"grpc_clients", | |
] } | |
tracing = "0.1" | |
-tracing-subscriber = { version = "0.3", features = ["env-filter"] } | |
+tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } | |
chrono = "0.4.31" | |
rand = "0.8" | |
constant_time_eq = "0.2.2" | |
diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs | |
index 1b80174631..3d3bff7143 100644 | |
--- a/services/identity/src/client_service.rs | |
+++ b/services/identity/src/client_service.rs | |
@@ -99,6 +99,7 @@ pub struct ClientService { | |
#[tonic::async_trait] | |
impl IdentityClientService for ClientService { | |
+ #[tracing::instrument(skip(self))] | |
async fn register_password_user_start( | |
&self, | |
request: tonic::Request<RegistrationStartRequest>, | |
@@ -811,10 +812,12 @@ impl IdentityClientService for ClientService { | |
Ok(Response::new(response)) | |
} | |
+ #[tracing::instrument(skip(self))] | |
async fn generate_nonce( | |
&self, | |
_request: tonic::Request<Empty>, | |
) -> Result<tonic::Response<GenerateNonceResponse>, tonic::Status> { | |
+ info!("generate nonce was called"); | |
let nonce_data = generate_nonce_data(&mut OsRng); | |
match self | |
.client | |
@@ -901,10 +904,12 @@ impl IdentityClientService for ClientService { | |
Ok(response) | |
} | |
+ #[tracing::instrument(skip(self))] | |
async fn ping( | |
&self, | |
_request: tonic::Request<Empty>, | |
) -> Result<Response<Empty>, tonic::Status> { | |
+ info!("testing span works"); | |
let response = Response::new(Empty {}); | |
Ok(response) | |
} | |
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs | |
index 304859902a..12334ca374 100644 | |
--- a/services/identity/src/database.rs | |
+++ b/services/identity/src/database.rs | |
@@ -1089,6 +1089,7 @@ impl DatabaseClient { | |
&self, | |
nonce_data: NonceData, | |
) -> Result<PutItemOutput, Error> { | |
+ info!("adding nonce to nonces table"); | |
let item = HashMap::from([ | |
( | |
NONCE_TABLE_PARTITION_KEY.to_string(), | |
diff --git a/services/identity/src/main.rs b/services/identity/src/main.rs | |
index 5cca3c27c2..5915f66e6f 100644 | |
--- a/services/identity/src/main.rs | |
+++ b/services/identity/src/main.rs | |
@@ -43,7 +43,10 @@ async fn main() -> Result<(), BoxedError> { | |
.with_env_var(EnvFilter::DEFAULT_ENV) | |
.from_env_lossy(); | |
- let subscriber = tracing_subscriber::fmt().with_env_filter(filter).finish(); | |
+ let subscriber = tracing_subscriber::fmt() | |
+ .json() | |
+ .with_env_filter(filter) | |
+ .finish(); | |
tracing::subscriber::set_global_default(subscriber)?; | |
match config::parse_cli_command() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment