diff --git a/src/filter.rs b/src/filter.rs index 371fb95f..c87e086f 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -31,7 +31,7 @@ extern "C" fn start() { proxy_wasm::hostcalls::log(LogLevel::Critical, &panic_info.to_string()).unwrap(); })); proxy_wasm::set_root_context(|context_id| -> Box { - info!("set_root_context #{}", context_id); + info!("#{} set_root_context", context_id); Box::new(FilterRoot { context_id, config: Rc::new(FilterConfig::new()), diff --git a/src/filter/http_context.rs b/src/filter/http_context.rs index ac9cbb9c..a8491770 100644 --- a/src/filter/http_context.rs +++ b/src/filter/http_context.rs @@ -64,7 +64,7 @@ impl Filter { let descriptors = self.build_descriptors(rlp); if descriptors.is_empty() { debug!( - "process_rate_limit_policy: empty descriptors #{}", + "#{} process_rate_limit_policy: empty descriptors", self.context_id ); return Action::Continue; @@ -93,8 +93,8 @@ impl Filter { ) { Ok(call_id) => { debug!( - "Initiated gRPC call (id# {}) to Limitador #{}", - call_id, self.context_id + "#{} initiated gRPC call (id# {}) to Limitador", + self.context_id, call_id ); Action::Pause } @@ -148,8 +148,8 @@ impl Filter { { None => { debug!( - "pattern_expression_applies: selector not found: {}, defaulting to `` #{}", - p_e.selector, self.context_id + "#{} pattern_expression_applies: selector not found: {}, defaulting to ``", + self.context_id, p_e.selector ); "".to_string() } @@ -158,8 +158,8 @@ impl Filter { Some(attribute_bytes) => match String::from_utf8(attribute_bytes) { Err(e) => { debug!( - "pattern_expression_applies: failed to parse selector value: {}, error: {} #{}", - p_e.selector, e, self.context_id, + "#{} pattern_expression_applies: failed to parse selector value: {}, error: {}", + self.context_id, p_e.selector, e ); return false; } @@ -196,8 +196,8 @@ impl Filter { { None => { debug!( - "build_single_descriptor: selector not found: {} #{}", - selector_item.selector, self.context_id, + "#{} build_single_descriptor: selector not found: {}", + self.context_id, selector_item.selector ); match &selector_item.default { None => return None, // skipping the entire descriptor @@ -209,8 +209,8 @@ impl Filter { Some(attribute_bytes) => match String::from_utf8(attribute_bytes) { Err(e) => { debug!( - "build_single_descriptor: failed to parse selector value: {}, error: {} #{}", - selector_item.selector, e, self.context_id + "#{} build_single_descriptor: failed to parse selector value: {}, error: {}", + self.context_id, selector_item.selector, e ); return None; } @@ -242,7 +242,7 @@ impl Filter { impl HttpContext for Filter { fn on_http_request_headers(&mut self, _: usize, _: bool) -> Action { - debug!("on_http_request_headers #{}", self.context_id); + debug!("#{} on_http_request_headers", self.context_id); for header in TracingHeader::all() { if let Some(value) = self.get_http_request_header_bytes(header.as_str()) { @@ -257,31 +257,35 @@ impl HttpContext for Filter { { None => { debug!( - "Allowing request to pass because zero descriptors generated #{}", + "#{} allowing request to pass because zero descriptors generated", self.context_id ); Action::Continue } Some(rlp) => { - debug!("ratelimitpolicy selected {} #{}", rlp.name, self.context_id); + debug!("#{} ratelimitpolicy selected {}", self.context_id, rlp.name); self.process_rate_limit_policy(rlp) } } } fn on_http_response_headers(&mut self, _num_headers: usize, _end_of_stream: bool) -> Action { - debug!("on_http_response_headers #{}", self.context_id); + debug!("#{} on_http_response_headers", self.context_id); for (name, value) in &self.response_headers_to_add { self.add_http_response_header(name, value); } Action::Continue } + + fn on_log(&mut self) { + debug!("#{} completed.", self.context_id); + } } impl Context for Filter { fn on_grpc_call_response(&mut self, token_id: u32, status_code: u32, resp_size: usize) { debug!( - "on_grpc_call_response: received gRPC call response: token: {token_id}, status: {status_code} #{}", + "#{} on_grpc_call_response: received gRPC call response: token: {token_id}, status: {status_code}", self.context_id ); diff --git a/src/filter/root_context.rs b/src/filter/root_context.rs index 73598701..d15ea1ce 100644 --- a/src/filter/root_context.rs +++ b/src/filter/root_context.rs @@ -28,14 +28,14 @@ impl RootContext for FilterRoot { ); info!( - "{} {} root-context #{}: VM started", - WASM_SHIM_HEADER, full_version, self.context_id + "#{} {} {}: VM started", + self.context_id, WASM_SHIM_HEADER, full_version ); true } fn create_http_context(&self, context_id: u32) -> Option> { - debug!("create_http_context #{}", context_id); + debug!("#{} create_http_context", context_id); Some(Box::new(Filter { context_id, config: Rc::clone(&self.config), @@ -45,7 +45,7 @@ impl RootContext for FilterRoot { } fn on_configure(&mut self, _config_size: usize) -> bool { - info!("on_configure #{}", self.context_id); + info!("#{} on_configure", self.context_id); let configuration: Vec = match self.get_plugin_configuration() { Some(c) => c, None => return false,