(
_: Option<i64>, span: Box<dyn Any>, execute_data: &mut ExecuteData, return_value: &mut ZVal,
)
| 306 | |
| 307 | #[instrument(skip_all)] |
| 308 | fn after_hook( |
| 309 | _: Option<i64>, span: Box<dyn Any>, execute_data: &mut ExecuteData, return_value: &mut ZVal, |
| 310 | ) -> crate::Result<()> { |
| 311 | let mut span = span.downcast::<Span>().expect("Downcast to Span failed"); |
| 312 | |
| 313 | if let Some(b) = return_value.as_bool() { |
| 314 | if !b { |
| 315 | span.span_object_mut().is_error = true; |
| 316 | |
| 317 | let this = get_this_mut(execute_data)?; |
| 318 | let code = this.call(&"getResultCode".to_ascii_lowercase(), [])?; |
| 319 | let code = code.as_long().context("ResultCode isn't int")?; |
| 320 | debug!(code, "get memcached result code"); |
| 321 | |
| 322 | if code != 0 { |
| 323 | let message = this.call(&"getResultMessage".to_ascii_lowercase(), [])?; |
| 324 | let message = message |
| 325 | .as_z_str() |
| 326 | .context("ResultMessage isn't string")? |
| 327 | .to_str()?; |
| 328 | debug!(message, "get memcached result message"); |
| 329 | |
| 330 | span.add_log([ |
| 331 | ("ResultCode", code.to_string()), |
| 332 | ("ResultMessage", message.to_owned()), |
| 333 | ]); |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | log_exception(&mut *span); |
| 339 | |
| 340 | Ok(()) |
| 341 | } |
| 342 | |
| 343 | fn create_exit_span( |
| 344 | request_id: Option<i64>, class_name: &str, function_name: &str, remote_peer: &str, |
nothing calls this directly
no test coverage detected