<commit_before>require 'new_relic/agent/method_tracer'
require 'benchmark'

module NewRelic
  module Agent
    module Instrumentation
      module VerticaInstrumentation

        def self.included(klass)
          klass.class_eval do
            alias_method :query_without_instrumentation, :query
            alias_method :query, :query_with_instrumentation
          end
        end

        def query_with_instrumentation(sql, options = {}, &block)
          result = nil
          duration = Benchmark.realtime do
            result = query_without_instrumentation(sql, options, &block)
          end

          if NewRelic::Agent.is_execution_traced?
            NewRelic::Agent.instance.transaction_sampler.notice_sql(sql, nil, duration)
          end<commit_msg>Also trace it as a call.<commit_after>require 'new_relic/agent/method_tracer'
require 'benchmark'

module NewRelic
  module Agent
    module Instrumentation
      module VerticaInstrumentation

        def self.included(klass)
          klass.class_eval do
            alias_method :query_without_instrumentation, :query
            alias_method :query, :query_with_instrumentation
          end
        end

        def query_with_instrumentation(sql, options = {}, &block)
          result = nil
          duration = Benchmark.realtime do
            result = query_without_instrumentation(sql, options, &block)
          end

          if NewRelic::Agent.is_execution_traced?
            NewRelic::Agent.instance.transaction_sampler.notice_sql(sql, nil, duration)
            NewRelic::Agent.instance.stats_engine.get_stats_no_scope('ActiveRecord/all').trace_call(duration)
          end
{'fraction_non_alphanumeric': 0.06751054852320675, 'fraction_numerical': 0.0, 'mean_word_length': 2.6483516483516483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2952418', 'n_tokens_mistral': 466, 'n_tokens_neox': 454, 'n_words': 93}