MCPcopy Create free account
hub / github.com/apache/skywalking-php / log_exception

Function log_exception

src/plugin/mod.rs:140–165  ·  view source on GitHub ↗
(span: &mut impl HandleSpanObject)

Source from the content-addressed store, hash-verified

138}
139
140fn log_exception(span: &mut impl HandleSpanObject) -> Option<&mut ZObj> {
141 let mut ex = unsafe { ZObj::try_from_mut_ptr(eg!(exception)) };
142 if let Some(ex) = ex.as_mut() {
143 let span_object = span.span_object_mut();
144 span_object.is_error = true;
145
146 let mut logs = Vec::new();
147 if let Ok(class_name) = ex.get_class().get_name().to_str() {
148 logs.push(("error.kind", class_name.to_owned()));
149 }
150 if let Some(message) = ex.get_property("message").as_z_str() {
151 if let Ok(message) = message.to_str() {
152 logs.push(("message", message.to_owned()));
153 }
154 }
155 if let Ok(stack) = ex.call("getTraceAsString", []) {
156 if let Some(stack) = stack.as_z_str().and_then(|s| s.to_str().ok()) {
157 logs.push(("stack", stack.to_owned()));
158 }
159 }
160 if !logs.is_empty() {
161 span_object.add_log(logs);
162 }
163 }
164 ex
165}

Callers 11

hook_pdo_constructMethod · 0.85
after_hookFunction · 0.85
after_hookFunction · 0.85
finish_exit_spanMethod · 0.85
after_manager_crud_hookFunction · 0.85
after_hookFunction · 0.85
hook_mysqli_connectMethod · 0.85
hook_mysqli_methodsMethod · 0.85
after_hookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected