File tree Expand file tree Collapse file tree
src/DDTrace/Integrations/Curl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,12 +121,15 @@ public function init(): int
121121 list ($ ch , $ requestSpan ) = $ requestSpan ;
122122 $ requestSpan ->metrics ["_dd.measured " ] = 1 ;
123123 $ info = curl_getinfo ($ ch );
124- if (isset ($ requestSpan ->meta ['network.destination.name ' ]) && $ requestSpan ->meta ['network.destination.name ' ] !== 'unparsable-host ' ) {
124+ if (empty ($ info ["http_code " ])) {
125+ $ saveSpans = true ;
126+ }
127+
128+ if (isset ($ requestSpan ->meta [Tag::NETWORK_DESTINATION_NAME ]) && $ requestSpan ->meta [Tag::NETWORK_DESTINATION_NAME ] !== 'unparsable-host ' ) {
125129 continue ;
126130 }
127131
128132 if (empty ($ info ["http_code " ])) {
129- $ saveSpans = true ;
130133 if (!isset ($ error_trace )) {
131134 $ error_trace = \DDTrace \get_sanitized_exception_trace (new \Exception (), 1 );
132135 }
@@ -183,16 +186,15 @@ public function init(): int
183186 }
184187
185188 list (, $ spans ) = $ data ;
189+ if (empty ($ spans )) {
190+ return ;
191+ }
186192
187193 if (!isset ($ hook ->returned ["result " ]) || $ hook ->returned ["result " ] == CURLE_OK ) {
188- if (empty ($ spans )) {
189- return ;
190- }
191-
192194 foreach ($ spans as $ requestSpan ) {
193195 list ($ ch , $ requestSpan ) = $ requestSpan ;
194196 if ($ ch === $ handle ) {
195- if (isset ($ requestSpan ->meta [' network.destination.name ' ]) && $ requestSpan ->meta [' network.destination.name ' ] !== 'unparsable-host ' ) {
197+ if (isset ($ requestSpan ->meta [Tag:: NETWORK_DESTINATION_NAME ]) && $ requestSpan ->meta [Tag:: NETWORK_DESTINATION_NAME ] !== 'unparsable-host ' ) {
196198 continue ;
197199 }
198200 $ info = curl_getinfo ($ ch );
You can’t perform that action at this time.
0 commit comments