Skip to content

Commit

Permalink
Cleanup and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
itsderek23 committed Sep 23, 2019
1 parent 7da3f13 commit 84575a5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/scout_apm/instant/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def call

def preconditions_met?
if dev_trace_disabled?
# The line below is very noise as it is called on every request.
# logger.debug("DevTrace: isn't activated via config. Try: SCOUT_DEV_TRACE=true rails server")
return false
end
Expand Down
2 changes: 1 addition & 1 deletion lib/scout_apm/layer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def children
# backtrace of where it occurred.
attr_accessor :backtrace

# The file name associated with the layer. Used for autoinstruments overhead logging.
# The file name associated with the layer. Only used for autoinstruments overhead logging.
attr_accessor :file_name

# As we go through a part of a request, instrumentation can store additional data
Expand Down
2 changes: 1 addition & 1 deletion lib/scout_apm/periodic_work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def log_layer_histograms
{total: total=v.map(&:last).inject(:+), significant: (v.last.last/total.to_f).round(2)}
]
}.to_h
context.logger.debug("AutoInstrument Layer Histograms: #{hists_summary.pretty_inspect}")
context.logger.debug("AutoInstrument Significant Layer Histograms: #{hists_summary.pretty_inspect}")
end

# XXX: Move logic into a RequestHistogramsByTime class that can keep the timeout logic in it
Expand Down
10 changes: 3 additions & 7 deletions lib/scout_apm/tracked_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,12 @@ def capture_backtrace?(layer)
# Returns +true+ if the total call time of AutoInstrument layers exceeds +AUTO_INSTRUMENT_TIMING_THRESHOLD+ and
# records a Histogram of insignificant / significant layers by file name.
def layer_insignificant?(layer)
result = false
result = false # default is significant
if layer.type == 'AutoInstrument'
if layer.total_call_time < AUTO_INSTRUMENT_TIMING_THRESHOLD
result = true
result = true # not significant
end
# 0 = not significant, 1 = significant
@agent_context.auto_instruments_layer_histograms.add(layer.file_name, (result ? 0 : 1))
end
result
Expand Down Expand Up @@ -236,11 +237,6 @@ def start_request(layer)
def stop_request
@stopping = true

if layer_finder.scope
# context.logger.debug("AutoInstrument Ignored Layers [#{layer_finder.scope.name}] : #{@ignored_layers.sort_by{ |k, v| v }.reverse.to_h}")
# context.logger.debug("AutoInstrument Kept Layers [#{layer_finder.scope.name}] : #{@kept_layers.sort_by{ |k, v| v }.reverse.to_h}")
end

if @recorder
@recorder.record!(self)
end
Expand Down

0 comments on commit 84575a5

Please sign in to comment.