As of Drupal >=7.22, this is possible! Patch is attached, though currently it has to be enabled manually:

drush vset drupal_http_request_function tracelytics_drupal_http_request

This works quite similarly to an existing cURL layer, generates a backtrace, and supports full-stack application tracing (propagates the X-Trace header). I've marked it as major, as it should provide a lot of insight into currently missing calls (like the Solr module).

Comments

Eronarn’s picture

Status: Active » Needs review
pdrake’s picture

Status: Needs review » Needs work

This looks pretty good - some minor notes below. Also, I would like to see an option for this in the admin settings form. You can check the VERSION constant using version_compare to enable/disable the option.

+++ b/tracelytics.moduleundefined
@@ -303,3 +303,61 @@ function tracelytics_set_partition($partition) {
+    $remote_host .= ":" . $uri['port'];

This should use single quotes around the colon and could use the logic from drupal_http_request: isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';

+++ b/tracelytics.moduleundefined
@@ -303,3 +303,61 @@ function tracelytics_set_partition($partition) {
+  global $conf;

Personal preference here, I wouldn't mind seeing the global declaration at the beginning of the function.

+++ b/tracelytics.moduleundefined
@@ -303,3 +303,61 @@ function tracelytics_set_partition($partition) {
\ No newline at end of file

This will remove the newline at the end of the file.

Eronarn’s picture

I agree about the admin setting being necessary, but I wasn't sure how to use system_settings_form to best handle the requirement for the variable to be either not present or set as tracelytics_drupal_http_request... just a checkbox won't work unless we also add a handler.

pdrake’s picture

I think a checkbox should be fine. It would be unchecked if that variable is empty, checked if it is set to tracelytics_drupal... and disabled if it is set to anything else (with a description as to why it is disabled), right?

Eronarn’s picture

Here's a reroll of that patch with the above changes, I think it still needs work but it should be closer at least

pdrake’s picture

Status: Needs work » Fixed

This is committed to 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.