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

Method hook_curl_exec

src/plugin/plugin_curl.rs:151–178  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

149 }
150
151 fn hook_curl_exec(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
152 (
153 Box::new(|request_id, execute_data| {
154 validate_num_args(execute_data, 1)?;
155
156 let cid = Self::get_resource_id(execute_data)?;
157 let ch = execute_data.get_parameter(0);
158
159 let info = Self::get_curl_info(cid, ch.clone())?;
160
161 let span = Self::create_exit_span(request_id, &info)?;
162
163 if info.is_http {
164 Self::inject_sw_header(request_id, ch.clone(), &info)?;
165 }
166
167 Ok(Box::new(span))
168 }),
169 Box::new(move |_, span, execute_data, _| {
170 let mut span = span.downcast::<Span>().unwrap();
171
172 let ch = execute_data.get_parameter(0);
173 Self::finish_exit_span(&mut *span, ch)?;
174
175 Ok(())
176 }),
177 )
178 }
179
180 fn hook_curl_close(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
181 (

Callers 1

hookMethod · 0.80

Calls 2

validate_num_argsFunction · 0.85
create_exit_spanFunction · 0.70

Tested by

no test coverage detected