Module | PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging

In:

lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_base_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_benchmarking_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ac_rescue_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/ar_abstract_adapter_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/as_cache_extension.rb
lib/phusion_passenger/classic_rails_extensions/analytics_logging/av_benchmark_helper_extension.rb
lib/phusion_passenger/classic_rails_extensions/init.rb

### Methods

install! new_transaction_log

### Included Modules

ACBaseExtension ACBenchmarkingExtension ACRescueExtension AVBenchmarkHelperExtension ARAbstractAdapterExtension CacheStoreExtension

### Classes and Modules

Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ACBaseExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ACBenchmarkingExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ACRescueExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ARAbstractAdapterExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::AVBenchmarkHelperExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::CacheStoreExtension
Module PhusionPassenger::ClassicRailsExtensions::AnalyticsLogging::ConcreteCacheStoreExtension

### Public Class methods

install!(options)

[Source]

         # File lib/phusion_passenger/classic_rails_extensions/init.rb, line 45
     45:         def self.install!(options)
     46:                 @@analytics_logger = options["analytics_logger"]
     47:                 # If the Ruby interpreter supports GC statistics then turn it on
     48:                 # so that the info can be logged.
     49:                 GC.enable_stats if GC.respond_to?(:enable_stats)
     50:
     51:                 if defined?(ActionController)
     52:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/ac_base_extension'
     53:                         ActionController::Base.class_eval do
     54:                                 include ACBaseExtension
     55:                                 alias_method_chain :perform_action, :passenger
     56:                                 alias_method_chain :render, :passenger
     57:                         end
     58:
     59:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/ac_benchmarking_extension'
     60:                         ActionController::Benchmarking::ClassMethods.class_eval do
     61:                                 include ACBenchmarkingExtension
     62:                                 alias_method_chain :benchmark, :passenger
     63:                         end
     64:
     65:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/ac_rescue_extension'
     66:                         ActionController::Rescue.class_eval do
     67:                                 include ACRescueExtension
     68:                                 alias_method_chain :rescue_action, :passenger
     69:                         end
     70:                 end
     71:
     72:                 if defined?(ActionView)
     73:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/av_benchmark_helper_extension'
     74:                         ActionView::Helpers::BenchmarkHelper.class_eval do
     75:                                 include AVBenchmarkHelperExtension
     76:                                 alias_method_chain :benchmark, :passenger
     77:                         end
     78:                 end
     79:
     80:                 if defined?(ActiveRecord)
     81:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/ar_abstract_adapter_extension'
     82:                         ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
     83:                                 include ARAbstractAdapterExtension
     84:                                 alias_method_chain :log, :passenger
     85:                         end
     86:                 end
     87:
     88:                 if defined?(ActiveSupport::Cache::Store) && Rails.cache
     89:                         require 'phusion_passenger/classic_rails_extensions/analytics_logging/as_cache_extension'
     90:                         ActiveSupport::Cache::Store.class_eval do
     91:                                 include CacheStoreExtension
     92:                                 case Rails::VERSION::MINOR
     93:                                 when 1
     94:                                         # Rails 2.1
     95:                                         alias_method :fetch, :fetch_2_1
     96:                                 when 2
     97:                                         # Rails 2.2
     98:                                         alias_method :fetch, :fetch_2_2
     99:                                 when 3
    100:                                         # Rails 2.3
    101:                                         alias_method :fetch, :fetch_2_3
    102:                                 end
    103:                         end
    104:                         Rails.cache.extend(ConcreteCacheStoreExtension)
    105:                 end
    106:         end

new_transaction_log(env, category = :requests) {|log| ...}

[Source]

         # File lib/phusion_passenger/classic_rails_extensions/init.rb, line 108
    108:         def self.new_transaction_log(env, category = :requests)
    109:                 if env[PASSENGER_TXN_ID]
    110:                         group_name = env[PASSENGER_GROUP_NAME]
    111:                         union_station_key = env[PASSENGER_UNION_STATION_KEY]
    112:                         log = @@analytics_logger.new_transaction(group_name, category,
    113:                                 union_station_key)
    114:                         begin
    115:                                 yield log
    116:                         ensure
    117:                                 log.close
    118:                         end
    119:                 end
    120:         end

[Validate]