Class: Atatus::Config Private
- Inherits:
-
Object
- Object
- Atatus::Config
- Extended by:
- Options
- Defined in:
- lib/atatus/config.rb,
lib/atatus/config/bytes.rb,
lib/atatus/config/options.rb,
lib/atatus/config/duration.rb,
lib/atatus/config/regexp_list.rb,
lib/atatus/config/wildcard_pattern_list.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.
Defined Under Namespace
Modules: Options Classes: Bytes, Duration, RegexpList, WildcardPatternList
Constant Summary collapse
- DEPRECATED_OPTIONS =
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.
%i[].freeze
Instance Attribute Summary collapse
- #__root_path ⇒ Object private
- #__view_paths ⇒ Object private
- #logger ⇒ Object private
- #options ⇒ Object readonly private
Instance Method Summary collapse
- #active ⇒ Object (also: #active?) private
- #active=(value) ⇒ Object private
- #app=(app) ⇒ Object private
- #assign(update) ⇒ Object private
- #available_instrumentations ⇒ Object private
- #collect_metrics? ⇒ Boolean private
- #custom_key_filters=(value) ⇒ Object private
-
#default_tags=(value) ⇒ Object
private
Deprecations.
- #disabled_instrumentations ⇒ Object private
- #disabled_instrumentations=(value) ⇒ Object private
- #enabled_instrumentations ⇒ Object private
- #ignore_url_patterns=(value) ⇒ Object private
-
#initialize(options = {}) {|_self| ... } ⇒ Config
constructor
private
rubocop:enable Metrics/LineLength, Layout/ExtraSpacing.
- #inspect ⇒ Object private
- #method_missing(name, *args) ⇒ Object private
- #replace_options(new_options) ⇒ Object private
- #span_frames_min_duration=(value) ⇒ Object private
- #span_frames_min_duration? ⇒ Boolean private
- #span_frames_min_duration_us ⇒ Object private
- #ssl_context ⇒ Object private
- #use_experimental_sql_parser=(value) ⇒ Object private
- #use_ssl? ⇒ Boolean private
Methods included from Options
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.
rubocop:enable Metrics/LineLength, Layout/ExtraSpacing
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/atatus/config.rb', line 102 def initialize( = {}) @options = load_schema assign() # Pick out config_file specifically as we need it now to load it, # but still need the other env vars to have precedence env = load_env if (env_config_file = env.delete(:config_file)) self.config_file = env_config_file end assign(load_config_file) assign(env) yield self if block_given? self.logger ||= build_logger @__view_paths ||= [] @__root_path ||= Dir.pwd end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ 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.
163 164 165 166 |
# File 'lib/atatus/config.rb', line 163 def method_missing(name, *args) return super unless DEPRECATED_OPTIONS.include?(name) warn "The option `#{name}' has been removed." end |
Instance Attribute Details
#__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.
125 126 127 |
# File 'lib/atatus/config.rb', line 125 def __root_path @__root_path 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.
125 126 127 |
# File 'lib/atatus/config.rb', line 125 def __view_paths @__view_paths 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.
126 127 128 |
# File 'lib/atatus/config.rb', line 126 def logger @logger end |
#options ⇒ 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.
128 129 130 |
# File 'lib/atatus/config.rb', line 128 def @options end |
Instance Method Details
#active ⇒ Object Also known as: active?
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.
264 265 266 |
# File 'lib/atatus/config.rb', line 264 def active enabled end |
#active=(value) ⇒ 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.
280 281 282 283 284 |
# File 'lib/atatus/config.rb', line 280 def active=(value) warn '[DEPRECATED] The option active has been renamed to enabled ' \ 'to align with other agents and with the remote config.' self.enabled = value end |
#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.
177 178 179 180 181 182 183 184 185 186 |
# File 'lib/atatus/config.rb', line 177 def app=(app) case app_type?(app) when :sinatra set_sinatra(app) when :rails set_rails(app) else self.service_name = 'ruby' end end |
#assign(update) ⇒ 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.
130 131 132 133 |
# File 'lib/atatus/config.rb', line 130 def assign(update) return unless update update.each { |key, value| send(:"#{key}=", value) } end |
#available_instrumentations ⇒ 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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/atatus/config.rb', line 135 def available_instrumentations %w[ action_dispatch delayed_job dynamo_db elasticsearch faraday http json mongo net_http rake redis resque sequel shoryuken sidekiq sinatra sneakers sucker_punch tilt ] end |
#collect_metrics? ⇒ 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.
192 193 194 |
# File 'lib/atatus/config.rb', line 192 def collect_metrics? metrics_interval > 0 end |
#custom_key_filters=(value) ⇒ 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.
251 252 253 254 255 256 257 258 |
# File 'lib/atatus/config.rb', line 251 def custom_key_filters=(value) unless value == self.class.schema[:custom_key_filters][:default] warn '[DEPRECATED] The option custom_key_filters is being removed. ' \ 'See sanitize_field_names for an alternative.' end set(:custom_key_filters, value) end |
#default_tags=(value) ⇒ 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.
Deprecations
236 237 238 239 240 |
# File 'lib/atatus/config.rb', line 236 def (value) warn '[DEPRECATED] The option default_tags has been renamed to ' \ 'default_labels.' self.default_labels = value end |
#disabled_instrumentations ⇒ 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.
260 261 262 |
# File 'lib/atatus/config.rb', line 260 def disabled_instrumentations disable_instrumentations end |
#disabled_instrumentations=(value) ⇒ 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.
269 270 271 272 273 |
# File 'lib/atatus/config.rb', line 269 def disabled_instrumentations=(value) warn '[DEPRECATED] The option disabled_instrumentations has been ' \ 'renamed to disable_instrumentations to align with other agents.' self.disable_instrumentations = value end |
#enabled_instrumentations ⇒ 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.
159 160 161 |
# File 'lib/atatus/config.rb', line 159 def enabled_instrumentations available_instrumentations - disable_instrumentations end |
#ignore_url_patterns=(value) ⇒ 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.
242 243 244 245 246 247 248 249 |
# File 'lib/atatus/config.rb', line 242 def ignore_url_patterns=(value) unless value == self.class.schema[:ignore_url_patterns][:default] warn '[DEPRECATED] The option ignore_url_patterns is being removed. ' \ 'Consider using transaction_ignore_urls instead.' end set(:ignore_url_patterns, value) end |
#inspect ⇒ 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.
230 231 232 |
# File 'lib/atatus/config.rb', line 230 def inspect super.split.first + '>' end |
#replace_options(new_options) ⇒ 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.
168 169 170 171 172 173 174 175 |
# File 'lib/atatus/config.rb', line 168 def () return if .nil? || .empty? = @options.dup .each do |key, value| .fetch(key.to_sym).set(value) end @options = end |
#span_frames_min_duration=(value) ⇒ 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.
200 201 202 203 |
# File 'lib/atatus/config.rb', line 200 def span_frames_min_duration=(value) super @span_frames_min_duration_us = nil end |
#span_frames_min_duration? ⇒ 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.
196 197 198 |
# File 'lib/atatus/config.rb', line 196 def span_frames_min_duration? span_frames_min_duration != 0 end |
#span_frames_min_duration_us ⇒ 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.
205 206 207 |
# File 'lib/atatus/config.rb', line 205 def span_frames_min_duration_us @span_frames_min_duration_us ||= span_frames_min_duration * 1_000_000 end |
#ssl_context ⇒ 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.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/atatus/config.rb', line 209 def ssl_context return unless use_ssl? @ssl_context ||= OpenSSL::SSL::SSLContext.new.tap do |context| if server_ca_cert context.ca_file = server_ca_cert else context.cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths) end context.verify_mode = if verify_server_cert OpenSSL::SSL::VERIFY_PEER else OpenSSL::SSL::VERIFY_NONE end end end |
#use_experimental_sql_parser=(value) ⇒ 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.
275 276 277 278 |
# File 'lib/atatus/config.rb', line 275 def use_experimental_sql_parser=(value) warn '[DEPRECATED] The new SQL parser is now the default. To use the old one, ' 'use use_legacy_sql_parser and please report why you wish to do so.' end |
#use_ssl? ⇒ 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.
188 189 190 |
# File 'lib/atatus/config.rb', line 188 def use_ssl? server_url.start_with?('https') end |