lib/appoptics_apm/base.rb in appoptics_apm-4.5.2 vs lib/appoptics_apm/base.rb in appoptics_apm-4.6.0
- old
+ new
@@ -1,11 +1,11 @@
# Copyright (c) 2016 SolarWinds, LLC.
# All rights reserved.
# Constants from liboboe
-APPOPTICS_TRACE_NEVER = 0
-APPOPTICS_TRACE_ALWAYS = 1
+APPOPTICS_TRACE_DISABLED = 0
+APPOPTICS_TRACE_ENABLED = 1
# OBOE_SAMPLE_RATE_SOURCE_FILE = 1
# OBOE_SAMPLE_RATE_SOURCE_DEFAULT = 2
# OBOE_SAMPLE_RATE_SOURCE_OBOE = 3
# OBOE_SAMPLE_RATE_SOURCE_LAST_OBOE = 4
@@ -145,33 +145,37 @@
return false if AppOpticsAPM.layer_op.nil? || AppOpticsAPM.layer_op.empty? || !operation.respond_to?(:to_sym)
AppOpticsAPM.layer_op.last == operation.to_sym
end
+ # TODO ME review use of these boolean statements
+ # ____ they should now be handled by TransactionSettings,
+ # ____ because there can be exceptions to :enabled and :disabled
+
##
- # Returns true if the tracing_mode is set to always.
+ # Returns true if the tracing_mode is set to :enabled.
# False otherwise
#
- def always?
+ def tracing_enabled?
AppOpticsAPM::Config[:tracing_mode] &&
- AppOpticsAPM::Config[:tracing_mode].to_sym == :always
+ [:enabled, :always].include?(AppOpticsAPM::Config[:tracing_mode].to_sym)
end
##
- # Returns true if the tracing_mode is set to never.
+ # Returns true if the tracing_mode is set to :disabled.
# False otherwise
#
- def never?
+ def tracing_disabled?
AppOpticsAPM::Config[:tracing_mode] &&
- AppOpticsAPM::Config[:tracing_mode].to_sym == :never
+ [:disabled, :never].include?(AppOpticsAPM::Config[:tracing_mode].to_sym)
end
##
# Returns true if we are currently tracing a request
# False otherwise
#
def tracing?
- return false if !AppOpticsAPM.loaded || AppOpticsAPM.never?
+ return false if !AppOpticsAPM.loaded # || AppOpticsAPM.tracing_disabled?
AppOpticsAPM::Context.isSampled
end
def heroku?
ENV.key?('APPOPTICS_URL')