lib/oboe/config.rb in oboe-2.2.6 vs lib/oboe/config.rb in oboe-2.3.2
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2012 by Tracelytics, Inc.
+# Copyright (c) 2013 AppNeta, Inc.
# All rights reserved.
module Oboe
##
# This module exposes a nested configuration hash that can be used to
@@ -25,13 +25,27 @@
def self.initialize(data={})
# Setup default instrumentation values
@@instrumentation.each do |k|
@@config[k] = {}
@@config[k][:enabled] = true
+ @@config[k][:collect_backtraces] = false
@@config[k][:log_args] = true
end
+ # Set collect_backtraces defaults
+ Oboe::Config[:action_controller][:collect_backtraces] = true
+ Oboe::Config[:active_record][:collect_backtraces] = true
+ Oboe::Config[:action_view][:collect_backtraces] = true
+ Oboe::Config[:cassandra][:collect_backtraces] = true
+ Oboe::Config[:dalli][:collect_backtraces] = false
+ Oboe::Config[:memcache][:collect_backtraces] = false
+ Oboe::Config[:memcached][:collect_backtraces] = false
+ Oboe::Config[:mongo][:collect_backtraces] = true
+ Oboe::Config[:moped][:collect_backtraces] = true
+ Oboe::Config[:nethttp][:collect_backtraces] = true
+ Oboe::Config[:resque][:collect_backtraces] = true
+
# Special instrument specific flags
#
# :link_workers - associates enqueue operations with the jobs they queue by piggybacking
# an additional argument that is stripped prior to job proecessing
# !!Note: Make sure both the queue side and the Resque workers are instrumented
@@ -45,12 +59,19 @@
# The oboe Ruby client has the ability to sanitize query literals
# from SQL statements. By default this is disabled. Enable to
# avoid collecting and reporting query literals to TraceView.
@@config[:sanitize_sql] = false
- update!(data)
-
+ # The default configuration
+ default_config = {
+ :tracing_mode => "through",
+ :reporter_host => "127.0.0.1",
+ :sample_rate => 300000,
+ :verbose => false
+ }
+ update!(default_config)
+
# For Initialization, mark this as the default SampleRate
@@config[:sample_source] = 2 # OBOE_SAMPLE_RATE_SOURCE_DEFAULT
end
def self.update!(data)
@@ -64,10 +85,14 @@
end
def self.[]=(key, value)
@@config[key.to_sym] = value
+ if key == :sampling_rate
+ Oboe.logger.warn "WARNING: :sampling_rate is not a supported setting for Oboe::Config. Please use :sample_rate."
+ end
+
if key == :sample_rate
# When setting SampleRate, note that it's been manually set
# OBOE_SAMPLE_RATE_SOURCE_FILE == 1
@@config[:sample_source] = 1
@@ -111,13 +136,7 @@
end
end
end
end
-config = {
- :tracing_mode => "through",
- :reporter_host => "127.0.0.1",
- :sample_rate => 300000,
- :verbose => false }
-
-Oboe::Config.initialize(config)
+Oboe::Config.initialize