It would be great if we could route performance details to an external application without writing to the database.

CommentFileSizeAuthor
#4 performance.2033707.patch7.76 KBbceyssens
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

malc0mn’s picture

hmmm... Implementing a new hook wouldn't cut it I think... Adding some sort of setting that allows you to write a custom function containing your logic to store the data. The function is passed an object containing the data and you do with it as you please.

It could be as simple as:


  if (variable_get('performance_detail', 0)) {
    // There used to be a module_invoke_all('performance', 'data') call here. As
    // it was undocumented and therefore unknown, it has been removed. The data
    // column has been kept so that we can re-implement if needed.
    $params['data'] = NULL;
    $function = variable_get('performance_detail_store', 'performance_log_details');
    call_user_func($function, $params);
  }

Would need logic to read the data back again to fill the detail page, that's a different story...

Anonymous’s picture

Would need logic to read the data back again to fill the detail page, that's a different story...

That could be left up to whatever module is routing the performance data elsewhere.

Think of it like using core's Syslog module instead of DBLog. Like I currently use Syslog to ship Drupal log messages to Logstash to be parsed and shipped elsewhere (such as Elasticsearch for storage), I'd love to be able to ship these performance metrics to something like statsd (probably via Logstash also, but that doesn't matter on the Drupal side).

malc0mn’s picture

The syslog vs dblog is implemented using a hook:

    // Call the logging hooks to log/process the message
    foreach (module_implements('watchdog') as $module) {
      module_invoke($module, 'watchdog', $log_entry);
    }

Although it's the Drupal way of doing things, I'm not sure it's suitable in the performance module. I'm afraid that this will have quite an impact especially for sites with lots of modules, hence my previously proposed approach.

I would like to be as Drupal standard as possible though... And using a hook is nice and clean...

Edit: but when detailed logging is enabled and we would use a hook approach like hook_watchdog, it would be triggered on every page load which I simply do not find acceptable...

bceyssens’s picture

Issue summary: View changes
FileSize
7.76 KB
malc0mn’s picture

Assigned: Unassigned » malc0mn
Status: Active » Fixed

Patch applied, modified a bit and backported to D6.

Available in next release.

Status: Fixed » Closed (fixed)

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