Class: ElasticAPM::Config Private
- Inherits:
-
Object
- Object
- ElasticAPM::Config
- Extended by:
- Options, Deprecations
- Defined in:
- lib/elastic_apm/config.rb,
lib/elastic_apm/config/bytes.rb,
lib/elastic_apm/config/options.rb,
lib/elastic_apm/config/duration.rb,
lib/elastic_apm/config/regexp_list.rb,
lib/elastic_apm/config/round_float.rb,
lib/elastic_apm/config/server_info.rb,
lib/elastic_apm/config/log_level_map.rb,
lib/elastic_apm/config/wildcard_pattern_list.rb,
lib/elastic_apm/config/round_float_hash_value.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, LogLevelMap, RegexpList, RoundFloat, RoundFloatHashValue, ServerInfo, WildcardPatternList
Constant Summary collapse
- SANITIZE_FIELD_NAMES_DEFAULT =
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.
%w[password passwd pwd secret *key *token* *session* *credit* *card* *auth* set-cookie].freeze
Instance Attribute Summary collapse
- #__root_path ⇒ Object private
- #__view_paths ⇒ Object private
- #logger ⇒ Object private
- #options ⇒ Object readonly private
Instance Method Summary collapse
- #app=(app) ⇒ Object private
- #assign(update) ⇒ Object private
- #available_instrumentations ⇒ Object private
- #collect_metrics? ⇒ Boolean private
- #enabled_instrumentations ⇒ Object private
-
#initialize(options = {}) {|_self| ... } ⇒ Config
constructor
private
rubocop:enable Layout/LineLength, Layout/ExtraSpacing.
- #inspect ⇒ Object private
- #log_ecs_formatting ⇒ Object private
- #log_ecs_formatting=(value) ⇒ 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_ssl? ⇒ Boolean private
- #version ⇒ Object private
Methods included from Options
Methods included from Deprecations
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 Layout/LineLength, Layout/ExtraSpacing
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/elastic_apm/config.rb', line 117 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? if self.logger.nil? || self.log_path self.logger = build_logger end @__view_paths ||= [] @__root_path ||= Dir.pwd 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.
142 143 144 |
# File 'lib/elastic_apm/config.rb', line 142 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.
142 143 144 |
# File 'lib/elastic_apm/config.rb', line 142 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.
142 143 144 |
# File 'lib/elastic_apm/config.rb', line 142 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.
144 145 146 |
# File 'lib/elastic_apm/config.rb', line 144 def @options 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.
193 194 195 196 197 198 199 200 201 202 |
# File 'lib/elastic_apm/config.rb', line 193 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.
146 147 148 149 |
# File 'lib/elastic_apm/config.rb', line 146 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.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/elastic_apm/config.rb', line 151 def available_instrumentations %w[ action_dispatch azure_storage_table delayed_job dynamo_db elasticsearch faraday http json mongo net_http rake racecar redis resque s3 sequel shoryuken sidekiq sinatra sneakers sns sqs 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.
208 209 210 |
# File 'lib/elastic_apm/config.rb', line 208 def collect_metrics? metrics_interval > 0 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.
180 181 182 |
# File 'lib/elastic_apm/config.rb', line 180 def enabled_instrumentations available_instrumentations - disable_instrumentations 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.
246 247 248 |
# File 'lib/elastic_apm/config.rb', line 246 def inspect super.split.first + '>' end |
#log_ecs_formatting ⇒ 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/elastic_apm/config.rb', line 106 def log_ecs_formatting log_ecs_reformatting end |
#log_ecs_formatting=(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.
110 111 112 |
# File 'lib/elastic_apm/config.rb', line 110 def log_ecs_formatting=(value) @options[:log_ecs_reformatting].set(value) 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.
184 185 186 187 188 189 190 191 |
# File 'lib/elastic_apm/config.rb', line 184 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.
216 217 218 219 |
# File 'lib/elastic_apm/config.rb', line 216 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.
212 213 214 |
# File 'lib/elastic_apm/config.rb', line 212 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.
221 222 223 |
# File 'lib/elastic_apm/config.rb', line 221 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.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/elastic_apm/config.rb', line 225 def ssl_context return unless use_ssl? @ssl_context ||= OpenSSL::SSL::SSLContext.new.tap do |context| if server_ca_cert_file context.ca_file = server_ca_cert_file 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_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.
204 205 206 |
# File 'lib/elastic_apm/config.rb', line 204 def use_ssl? server_url.start_with?('https') end |
#version ⇒ 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.
250 251 252 |
# File 'lib/elastic_apm/config.rb', line 250 def version @version ||= ServerInfo.new(self).version end |