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

Function get_peer_by_this

src/plugin/plugin_mysqli.rs:203–227  ·  view source on GitHub ↗
(this: &mut ZObj)

Source from the content-addressed store, hash-verified

201}
202
203fn get_peer_by_this(this: &mut ZObj) -> Option<String> {
204 let handle = this.handle();
205
206 debug!(handle, "start to call mysqli_get_host_info");
207
208 let host_info = match call("mysqli_get_host_info", [ZVal::from(this.to_ref_owned())]) {
209 Ok(host_info) => host_info,
210 Err(err) => {
211 error!(handle, ?err, "call mysqli_get_host_info failed");
212 return None;
213 }
214 };
215
216 host_info
217 .as_z_str()
218 .and_then(|info| info.to_str().ok())
219 .and_then(|info| info.split(' ').next())
220 .map(ToOwned::to_owned)
221 .map(|mut info| {
222 if !info.contains(':') {
223 info.push_str(":3306");
224 }
225 info
226 })
227}
228
229fn get_peer_by_parameters(execute_data: &mut ExecuteData, style: ApiStyle) -> String {
230 let mut peer = "".to_owned();

Callers 2

hook_mysqli_connectMethod · 0.85
hook_mysqli_methodsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected