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

Method hook_pdo_statement_methods

src/plugin/plugin_pdo.rs:143–168  ·  view source on GitHub ↗
(
        &self, function_name: &str,
    )

Source from the content-addressed store, hash-verified

141 }
142
143 fn hook_pdo_statement_methods(
144 &self, function_name: &str,
145 ) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
146 let function_name = function_name.to_owned();
147 (
148 Box::new(move |request_id, execute_data| {
149 let this = get_this_mut(execute_data)?;
150 let handle = this.handle();
151
152 debug!(handle, function_name, "call PDOStatement method");
153
154 let mut span = with_dsn(handle, |dsn| {
155 create_exit_span_with_dsn(request_id, "PDOStatement", &function_name, dsn)
156 })?;
157
158 if let Some(query) = this.get_property("queryString").as_z_str() {
159 span.add_tag(TAG_DB_STATEMENT, query.to_str()?);
160 } else {
161 warn!("PDOStatement queryString is empty");
162 }
163
164 Ok(Box::new(span) as _)
165 }),
166 Box::new(after_hook),
167 )
168 }
169}
170
171fn hack_dtor(this: &mut ZObj, new_dtor: sys::zend_object_dtor_obj_t) {

Callers 1

hookMethod · 0.80

Calls 3

get_this_mutFunction · 0.85
with_dsnFunction · 0.85

Tested by

no test coverage detected