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

Method hook_pdo_methods

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

Source from the content-addressed store, hash-verified

115 }
116
117 fn hook_pdo_methods(
118 &self, function_name: &str,
119 ) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
120 let function_name = function_name.to_owned();
121 (
122 Box::new(move |request_id, execute_data| {
123 let handle = get_this_mut(execute_data)?.handle();
124
125 debug!(handle, function_name, "call PDO method");
126
127 let mut span = with_dsn(handle, |dsn| {
128 create_exit_span_with_dsn(request_id, "PDO", &function_name, dsn)
129 })?;
130
131 if execute_data.num_args() >= 1 {
132 if let Some(statement) = execute_data.get_parameter(0).as_z_str() {
133 span.add_tag(TAG_DB_STATEMENT, statement.to_str()?);
134 }
135 }
136
137 Ok(Box::new(span) as _)
138 }),
139 Box::new(after_hook),
140 )
141 }
142
143 fn hook_pdo_statement_methods(
144 &self, function_name: &str,

Callers 1

hookMethod · 0.80

Calls 3

get_this_mutFunction · 0.85
with_dsnFunction · 0.85

Tested by

no test coverage detected