Skip to content

Commit

Permalink
standard
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Oct 28, 2024
1 parent 8648852 commit 1b2aa98
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/datadog/di/instrumenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,19 @@ def hook_line(probe, &block)
# this optimization just yet and create a trace point for each probe.

tp = TracePoint.new(:line) do |tp|
begin
# If trace point is not targeted, we must verify that the invocation
# is the file & line that we want, because untargeted trace points
# are invoked for *each* line of Ruby executed.
if iseq || tp.lineno == probe.line_no && probe.file_matches?(tp.path)
if rate_limiter.nil? || rate_limiter.allow?
# & is to stop steep complaints, block is always present here.
block&.call(probe: probe, trace_point: tp, caller_locations: caller_locations)
end
# If trace point is not targeted, we must verify that the invocation
# is the file & line that we want, because untargeted trace points
# are invoked for *each* line of Ruby executed.
if iseq || tp.lineno == probe.line_no && probe.file_matches?(tp.path)
if rate_limiter.nil? || rate_limiter.allow?
# & is to stop steep complaints, block is always present here.
block&.call(probe: probe, trace_point: tp, caller_locations: caller_locations)
end
rescue => exc
raise if settings.dynamic_instrumentation.propagate_all_exceptions
logger.warn("Unhandled exception in line trace point: #{exc.class}: #{exc}")
# TODO test this path
end
rescue => exc
raise if settings.dynamic_instrumentation.propagate_all_exceptions
logger.warn("Unhandled exception in line trace point: #{exc.class}: #{exc}")
# TODO test this path
end

# TODO internal check - remove or use a proper exception
Expand Down

0 comments on commit 1b2aa98

Please sign in to comment.