diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/authorization/cedar_authorizer.rs | 10 | ||||
| -rw-r--r-- | src/authorization/server.rs | 19 | ||||
| -rw-r--r-- | src/bin/cli.rs | 14 |
3 files changed, 15 insertions, 28 deletions
diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs index 662aafeb..940794b2 100644 --- a/src/authorization/cedar_authorizer.rs +++ b/src/authorization/cedar_authorizer.rs @@ -157,14 +157,12 @@ impl Authorizer for CedarAuthorizer { let decision = response.decision(); tracing::info!( - method = %http_request.method, - host = %http_request.host, - path = %http_request.path, - scheme = %http_request.scheme, - protocol = %http_request.protocol, decision = ?decision, diagnostics = ?response.diagnostics(), - "Processing HTTP request" + host = %http_request.host, + method = %http_request.method, + path = %http_request.path, + "http" ); matches!(decision, cedar_policy::Decision::Allow) diff --git a/src/authorization/server.rs b/src/authorization/server.rs index 759a550d..90d3edf6 100644 --- a/src/authorization/server.rs +++ b/src/authorization/server.rs @@ -36,22 +36,9 @@ impl Server { F: FnOnce(tonic::transport::Server) -> tonic::transport::server::Router, { let builder = tonic::transport::Server::builder() - .trace_fn(|req| { - tracing::info!( - method = %req.method(), - path = %req.uri().path(), - content_type = req.headers().get("content-type").map_or("unknown", |v| v.to_str().unwrap_or("unknown")), - user_agent = req.headers().get("user-agent").map_or("unknown", |v| v.to_str().unwrap_or("unknown")), - x_request_id = req.headers().get("x-request-id").map_or("none", |v| v.to_str().unwrap_or("none")), - "gRPC request" - ); - - tracing::info_span!( - "request", - method = %req.method(), - path = %req.uri().path(), - ) - }) + .trace_fn( + |req| tracing::info_span!("rpc", method = %req.method(), path = %req.uri().path()), + ) .timeout(std::time::Duration::from_secs(30)); let router = f(builder); Server { router } diff --git a/src/bin/cli.rs b/src/bin/cli.rs index 6f089353..837ef80f 100644 --- a/src/bin/cli.rs +++ b/src/bin/cli.rs @@ -71,17 +71,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { Commands::Server { addr } => { tracing_subscriber::fmt() .json() - .with_max_level(tracing::Level::INFO) + .with_ansi(false) .with_current_span(true) - .with_span_list(true) - .with_target(true) - .with_thread_ids(true) - .with_thread_names(true) .with_file(true) + .with_level(false) .with_line_number(true) + .with_max_level(tracing::Level::INFO) + .with_span_list(true) + .with_target(false) + .with_thread_ids(false) + .with_thread_names(false) .init(); - tracing::info!(address = %addr, "Starting authorization server"); + tracing::info!(address = %addr, "Starting"); authzd::authorization::Server::new(authzd::authorization::CedarAuthorizer::default())? .serve(addr.parse().unwrap()) .await?; |
