Class: StackifyRubyAPM::Config Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Config
- Includes:
- Log
- Defined in:
- lib/stackify_apm/config.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- DEFAULTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ config_file: 'config/stackify_apm.yml', json_config_file: 'config/stackify.json', rum_script_src: 'https://stckjs.azureedge.net/stckjs.js', application_name: 'Ruby Application', environment_name: ENV['RAILS_ENV'] || ENV['RACK_ENV'], already_instrumented_flag: false, rum_auto_injection: false, instrument: true, debug_logging: false, log_path: '/usr/local/stackify/stackify-ruby-apm/log/stackify-ruby-apm.log', log_level: Logger::INFO, log_trace_path: '/usr/local/stackify/stackify-ruby-apm/log/', max_queue_size: 500, # Maximum queue length of transactions before sending transactions to the APM. flush_interval: 1, # interval with which transactions should be sent to the APM. Default value: 10 seconds filter_exception_types: [], tracer_logger: nil, logger_byte_size: 50_000_000, # e.g, 50_000_000=50mb filenum_rotate: 20, debugger_byte_size: 20_000_000, debugger_filenum_rotate: 3, logtime_created: 0, http_status: nil, debug_transactions: false, trace_log_age_in_hour: 60 * 60, # e.g, 60*60=1hour, 60*2=2mins check_trace_log_per_hour: '1h', # e.g, 1h=every 1hour, 2m=every 2mins source_lines_error_app_frames: 5, source_lines_span_app_frames: 5, source_lines_error_library_frames: 0, source_lines_span_library_frames: 0, span_frames_min_duration: -1, # it will collect stack traces for all spans disabled_spies: %w[json], view_paths: [], root_path: Dir.pwd, stackify_properties_file: '/usr/local/stackify/stackify-ruby-apm/stackify.properties' }.freeze
- ENV_TO_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'STACKIFY_APM_ENVIRONMENT_NAME' => 'environment_name', 'STACKIFY_APM_RUM_SCRIPT_SRC' => 'rum_script_src', 'STACKIFY_APM_RUM_AUTO_INJECTION' => 'rum_auto_injection', 'STACKIFY_ALREADY_INSTRUMENTED_FLAG' => 'already_instrumented_flag', 'STACKIFY_APM_DEBUG_LOGGING' => 'debug_logging', 'STACKIFY_APM_INSTRUMENT' => [:bool, 'instrument'], 'STACKIFY_APM_HOSTNAME' => 'hostname', 'STACKIFY_APM_LOG_PATH' => 'log_path', 'STACKIFY_APM_LOG_LEVEL' => [:int, 'log_level'], 'STACKIFY_APM_APPLICATION_NAME' => 'application_name', 'STACKIFY_APM_SOURCE_LINES_ERROR_APP_FRAMES' => [:int, 'source_lines_error_app_frames'], 'STACKIFY_APM_SOURCE_LINES_SPAN_APP_FRAMES' => [:int, 'source_lines_span_app_frames'], 'STACKIFY_APM_SOURCE_LINES_ERROR_LIBRARY_FRAMES' => [:int, 'source_lines_error_library_frames'], 'STACKIFY_APM_SOURCE_LINES_SPAN_LIBRARY_FRAMES' => [:int, 'source_lines_span_library_frames'], 'STACKIFY_APM_SPAN_FRAMES_MIN_DURATION' => [:int, 'span_frames_min_duration'], 'STACKIFY_APM_MAX_QUEUE_SIZE' => [:int, 'max_queue_size'], 'STACKIFY_APM_FLUSH_INTERVAL' => 'flush_interval', 'STACKIFY_APM_DISABLED_SPIES' => [:list, 'disabled_spies'] }.freeze
Constants included from Log
Instance Attribute Summary collapse
- #already_instrumented_flag ⇒ Object private
- #apm_disabled_in_rake ⇒ Object readonly private
- #application_name ⇒ Object private
- #check_trace_log_per_hour ⇒ Object private
- #client_id ⇒ Object readonly private
- #client_run_domain ⇒ Object readonly private
- #config_file ⇒ Object private
- #debug_logging ⇒ Object private
- #debug_transactions ⇒ Object private
- #debugger_byte_size ⇒ Object private
- #debugger_filenum_rotate ⇒ Object private
- #device_id ⇒ Object readonly private
- #disabled_spies ⇒ Object private
- #enabled_environments ⇒ Object private
- #environment_name ⇒ Object private
- #filenum_rotate ⇒ Object private
- #filter_exception_types ⇒ Object private
- #flush_interval ⇒ Object private
- #hostname ⇒ Object private
- #http_status ⇒ Object private
- #instrument ⇒ Object private
- #json_config_file ⇒ Object private
- #log_level ⇒ Object private
- #log_path ⇒ Object private
- #log_trace_path ⇒ Object private
- #logger ⇒ Object private
- #logger_byte_size ⇒ Object private
- #logtime_created ⇒ Object private
- #max_queue_size ⇒ Object private
- #root_path ⇒ Object private
- #rum_auto_injection ⇒ Object private
- #rum_script_injected ⇒ Object private
- #rum_script_src ⇒ Object private
- #source_lines_error_app_frames ⇒ Object private
- #source_lines_error_library_frames ⇒ Object private
- #source_lines_span_app_frames ⇒ Object private
- #source_lines_span_library_frames ⇒ Object private
- #span_frames_min_duration ⇒ Object private
- #stackify_properties_file ⇒ Object private
- #trace_log_age_in_hour ⇒ Object private
- #tracer_logger ⇒ Object private
- #view_paths ⇒ Object private
Instance Method Summary collapse
- #app=(app) ⇒ Object private
- #app_type?(app) ⇒ Boolean private
-
#available_spies ⇒ Object
private
available spies to use when framework is rails.
- #enabled_spies ⇒ Object private
-
#initialize(options = {}) {|_self| ... } ⇒ Config
constructor
private
A new instance of Config.
Methods included from Log
#debug, #error, #fatal, #info, #log, #warn
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ Config
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Config.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/stackify_apm/config.rb', line 78 def initialize( = {}) set_defaults set_from_args() set_from_config_file set_from_env yield self if block_given? build_logger if logger.nil? || log_path load_stackify_props end |
Instance Attribute Details
#already_instrumented_flag ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 |
# File 'lib/stackify_apm/config.rb', line 96 def already_instrumented_flag @already_instrumented_flag end |
#apm_disabled_in_rake ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
141 142 143 |
# File 'lib/stackify_apm/config.rb', line 141 def apm_disabled_in_rake @apm_disabled_in_rake end |
#application_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
102 103 104 |
# File 'lib/stackify_apm/config.rb', line 102 def application_name @application_name end |
#check_trace_log_per_hour ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
114 115 116 |
# File 'lib/stackify_apm/config.rb', line 114 def check_trace_log_per_hour @check_trace_log_per_hour end |
#client_id ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
139 140 141 |
# File 'lib/stackify_apm/config.rb', line 139 def client_id @client_id end |
#client_run_domain ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
142 143 144 |
# File 'lib/stackify_apm/config.rb', line 142 def client_run_domain @client_run_domain end |
#config_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 92 93 |
# File 'lib/stackify_apm/config.rb', line 91 def config_file @config_file end |
#debug_logging ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
108 109 110 |
# File 'lib/stackify_apm/config.rb', line 108 def debug_logging @debug_logging end |
#debug_transactions ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
131 132 133 |
# File 'lib/stackify_apm/config.rb', line 131 def debug_transactions @debug_transactions end |
#debugger_byte_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
111 112 113 |
# File 'lib/stackify_apm/config.rb', line 111 def debugger_byte_size @debugger_byte_size end |
#debugger_filenum_rotate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
112 113 114 |
# File 'lib/stackify_apm/config.rb', line 112 def debugger_filenum_rotate @debugger_filenum_rotate end |
#device_id ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
140 141 142 |
# File 'lib/stackify_apm/config.rb', line 140 def device_id @device_id end |
#disabled_spies ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 |
# File 'lib/stackify_apm/config.rb', line 133 def disabled_spies @disabled_spies end |
#enabled_environments ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 |
# File 'lib/stackify_apm/config.rb', line 99 def enabled_environments @enabled_environments end |
#environment_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 |
# File 'lib/stackify_apm/config.rb', line 93 def environment_name @environment_name end |
#filenum_rotate ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
110 111 112 |
# File 'lib/stackify_apm/config.rb', line 110 def filenum_rotate @filenum_rotate end |
#filter_exception_types ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
129 130 131 |
# File 'lib/stackify_apm/config.rb', line 129 def filter_exception_types @filter_exception_types end |
#flush_interval ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
127 128 129 |
# File 'lib/stackify_apm/config.rb', line 127 def flush_interval @flush_interval end |
#hostname ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'lib/stackify_apm/config.rb', line 103 def hostname @hostname end |
#http_status ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 |
# File 'lib/stackify_apm/config.rb', line 137 def http_status @http_status end |
#instrument ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
98 99 100 |
# File 'lib/stackify_apm/config.rb', line 98 def instrument @instrument end |
#json_config_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
92 93 94 |
# File 'lib/stackify_apm/config.rb', line 92 def json_config_file @json_config_file end |
#log_level ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 107 108 |
# File 'lib/stackify_apm/config.rb', line 106 def log_level @log_level end |
#log_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
105 106 107 |
# File 'lib/stackify_apm/config.rb', line 105 def log_path @log_path end |
#log_trace_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
119 120 121 |
# File 'lib/stackify_apm/config.rb', line 119 def log_trace_path @log_trace_path end |
#logger ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
107 108 109 |
# File 'lib/stackify_apm/config.rb', line 107 def logger @logger end |
#logger_byte_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
109 110 111 |
# File 'lib/stackify_apm/config.rb', line 109 def logger_byte_size @logger_byte_size end |
#logtime_created ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 |
# File 'lib/stackify_apm/config.rb', line 117 def logtime_created @logtime_created end |
#max_queue_size ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
126 127 128 |
# File 'lib/stackify_apm/config.rb', line 126 def max_queue_size @max_queue_size end |
#root_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
136 137 138 |
# File 'lib/stackify_apm/config.rb', line 136 def root_path @root_path end |
#rum_auto_injection ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
95 96 97 |
# File 'lib/stackify_apm/config.rb', line 95 def rum_auto_injection @rum_auto_injection end |
#rum_script_injected ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
97 98 99 |
# File 'lib/stackify_apm/config.rb', line 97 def rum_script_injected @rum_script_injected end |
#rum_script_src ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 |
# File 'lib/stackify_apm/config.rb', line 94 def rum_script_src @rum_script_src end |
#source_lines_error_app_frames ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
120 121 122 |
# File 'lib/stackify_apm/config.rb', line 120 def source_lines_error_app_frames @source_lines_error_app_frames end |
#source_lines_error_library_frames ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
122 123 124 |
# File 'lib/stackify_apm/config.rb', line 122 def source_lines_error_library_frames @source_lines_error_library_frames end |
#source_lines_span_app_frames ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
121 122 123 |
# File 'lib/stackify_apm/config.rb', line 121 def source_lines_span_app_frames @source_lines_span_app_frames end |
#source_lines_span_library_frames ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
123 124 125 |
# File 'lib/stackify_apm/config.rb', line 123 def source_lines_span_library_frames @source_lines_span_library_frames end |
#span_frames_min_duration ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
124 125 126 |
# File 'lib/stackify_apm/config.rb', line 124 def span_frames_min_duration @span_frames_min_duration end |
#stackify_properties_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
100 101 102 |
# File 'lib/stackify_apm/config.rb', line 100 def stackify_properties_file @stackify_properties_file end |
#trace_log_age_in_hour ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
113 114 115 |
# File 'lib/stackify_apm/config.rb', line 113 def trace_log_age_in_hour @trace_log_age_in_hour end |
#tracer_logger ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
116 117 118 |
# File 'lib/stackify_apm/config.rb', line 116 def tracer_logger @tracer_logger end |
#view_paths ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 |
# File 'lib/stackify_apm/config.rb', line 135 def view_paths @view_paths end |
Instance Method Details
#app=(app) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
144 145 146 147 148 149 150 151 152 |
# File 'lib/stackify_apm/config.rb', line 144 def app=(app) case app_type?(app) when :rails set_rails(app) else # TODO: define custom? self.application_name = 'ruby' end end |
#app_type?(app) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
154 155 156 157 158 159 160 161 162 |
# File 'lib/stackify_apm/config.rb', line 154 def app_type?(app) # if defined?(::Rails) && app.is_a?(Rails::Application) # return :rails # end return :rails if defined?(::Rails) && app.is_a?(Rails::Application) nil end |
#available_spies ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
available spies to use when framework is rails
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/stackify_apm/config.rb', line 165 def available_spies %w[ action_dispatch mongo net_http custom_instrumenter httpclient redis sequel tilt httprb curb curb/easy curb/multi stackify_logger ] end |
#enabled_spies ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/stackify_apm/config.rb', line 183 def enabled_spies # check if the framework is rails or sinatra sinatra_activerecord_spies = %w[ sinatra sinatra_activerecord/mysql_adapter sinatra_activerecord/postgresql_adapter sinatra_activerecord/sqlite_adapter ] new_available_spies = if defined? ::Sinatra::Base if defined? ActiveRecord available_spies + sinatra_activerecord_spies else available_spies end else available_spies end new_available_spies - disabled_spies end |