lib/elastic_apm/config.rb in elastic-apm-2.2.0 vs lib/elastic_apm/config.rb in elastic-apm-2.3.0
- old
+ new
@@ -38,10 +38,11 @@
ignore_url_patterns: [],
instrument: true,
instrumented_rake_tasks: [],
log_level: Logger::INFO,
log_path: nil,
+ metrics_interval: 30,
pool_size: 1,
source_lines_error_app_frames: 5,
source_lines_error_library_frames: 0,
source_lines_span_app_frames: 5,
source_lines_span_library_frames: 0,
@@ -76,10 +77,11 @@
'ELASTIC_APM_INSTRUMENT' => [:bool, 'instrument'],
'ELASTIC_APM_INSTRUMENTED_RAKE_TASKS' =>
[:list, 'instrumented_rake_tasks'],
'ELASTIC_APM_LOG_LEVEL' => [:int, 'log_level'],
'ELASTIC_APM_LOG_PATH' => 'log_path',
+ 'ELASTIC_APM_METRICS_INTERVAL' => [:int, 'metrics_interval'],
'ELASTIC_APM_POOL_SIZE' => [:int, 'pool_size'],
'ELASTIC_APM_SERVICE_NAME' => 'service_name',
'ELASTIC_APM_SERVICE_VERSION' => 'service_version',
'ELASTIC_APM_SOURCE_LINES_ERROR_APP_FRAMES' =>
[:int, 'source_lines_error_app_frames'],
@@ -94,12 +96,18 @@
'ELASTIC_APM_TRANSACTION_SAMPLE_RATE' =>
[:float, 'transaction_sample_rate'],
'ELASTIC_APM_VERIFY_SERVER_CERT' => [:bool, 'verify_server_cert']
}.freeze
- DURATION_KEYS = %i[api_request_time span_frames_min_duration].freeze
- DURATION_DEFAULT_UNITS = { span_frames_min_duration: 'ms' }.freeze
+ DURATION_KEYS = %i[
+ api_request_time
+ span_frames_min_duration
+ metrics_interval
+ ].freeze
+ DURATION_DEFAULT_UNITS = { # default is 's'
+ span_frames_min_duration: 'ms'
+ }.freeze
SIZE_KEYS = %i[api_request_size].freeze
SIZE_DEFAULT_UNITS = { api_request_size: 'kb' }.freeze
def initialize(options = {})
@@ -144,10 +152,11 @@
attr_accessor :instrument
attr_accessor :instrumented_rake_tasks
attr_accessor :log_level
attr_accessor :log_path
attr_accessor :logger
+ attr_accessor :metrics_interval
attr_accessor :pool_size
attr_accessor :service_name
attr_accessor :service_version
attr_accessor :source_lines_error_app_frames
attr_accessor :source_lines_error_library_frames
@@ -273,9 +282,13 @@
if name.to_s.end_with?('=')
raise ConfigError, "No such option `#{name.to_s.delete('=')}'"
end
super
+ end
+
+ def collect_metrics?
+ metrics_interval != 0
end
private
def assign(options)