You are here

function new_relic_rpm_views_post_render in New Relic 8

Same name and namespace in other branches
  1. 2.x new_relic_rpm.module \new_relic_rpm_views_post_render()
  2. 2.0.x new_relic_rpm.module \new_relic_rpm_views_post_render()

Implements hook_views_post_render().

File

./new_relic_rpm.module, line 83
Drupal module implementing New Relic.

Code

function new_relic_rpm_views_post_render(ViewExecutable $view) {
  if (!\Drupal::config('new_relic_rpm.settings')
    ->get('views_log_slow')) {
    return;
  }
  $execution_timer = Timer::stop(_new_relic_rpm_views_timer_name($view));
  if ($execution_timer['time'] > \Drupal::config('new_relic_rpm.settings')
    ->get('views_log_threshold')) {
    \Drupal::service('new_relic_rpm.adapter')
      ->recordCustomEvent('SlowView', [
      'views_id' => $view
        ->id(),
      'display_id' => $view->current_display,
      'execution_time' => $execution_timer['time'],
      'arguments' => $view->args,
    ]);
  }
}