Class: Hoss::Config Private
- Inherits:
-
Object
- Object
- Hoss::Config
- Extended by:
- Options
- Defined in:
- lib/hoss/config.rb,
lib/hoss/config/bytes.rb,
lib/hoss/config/options.rb,
lib/hoss/config/duration.rb,
lib/hoss/config/regexp_list.rb,
lib/hoss/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
- #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
-
#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_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
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/hoss/config.rb', line 85 def initialize( = {}) @options = load_schema if .is_a? String assign(api_key: ) else assign() end # 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) if self.debug == true || self.debug == 'true' assign( log_level: Logger::DEBUG, debug: true, log_path: '-' ) end unless self.disable_reporting.nil? self.disable_reporting = self.disable_reporting == 'true' || self.disable_reporting == true end 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.
146 147 148 149 |
# File 'lib/hoss/config.rb', line 146 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.
124 125 126 |
# File 'lib/hoss/config.rb', line 124 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.
124 125 126 |
# File 'lib/hoss/config.rb', line 124 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.
125 126 127 |
# File 'lib/hoss/config.rb', line 125 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.
127 128 129 |
# File 'lib/hoss/config.rb', line 127 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.
234 235 236 |
# File 'lib/hoss/config.rb', line 234 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.
245 246 247 248 249 |
# File 'lib/hoss/config.rb', line 245 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.
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/hoss/config.rb', line 160 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.
129 130 131 132 |
# File 'lib/hoss/config.rb', line 129 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.
134 135 136 137 138 139 140 |
# File 'lib/hoss/config.rb', line 134 def available_instrumentations %w[ http net_http faraday ] 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.
221 222 223 224 225 226 227 228 |
# File 'lib/hoss/config.rb', line 221 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
215 216 217 218 219 |
# File 'lib/hoss/config.rb', line 215 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.
230 231 232 |
# File 'lib/hoss/config.rb', line 230 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.
239 240 241 242 243 |
# File 'lib/hoss/config.rb', line 239 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.
142 143 144 |
# File 'lib/hoss/config.rb', line 142 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.
209 210 211 |
# File 'lib/hoss/config.rb', line 209 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.
151 152 153 154 155 156 157 158 |
# File 'lib/hoss/config.rb', line 151 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.
179 180 181 182 |
# File 'lib/hoss/config.rb', line 179 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.
175 176 177 |
# File 'lib/hoss/config.rb', line 175 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.
184 185 186 |
# File 'lib/hoss/config.rb', line 184 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.
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/hoss/config.rb', line 188 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_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.
171 172 173 |
# File 'lib/hoss/config.rb', line 171 def use_ssl? api_host.start_with?('https') end |