Skip to content

Commit

Permalink
DEBUG-3305 remove dependency on benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Jan 6, 2025
1 parent 9605f99 commit c841818
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/datadog/di/instrumenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# rubocop:disable Lint/AssignmentInCondition

require 'benchmark'

module Datadog
module DI
# Arranges to invoke a callback when a particular Ruby method or
Expand Down Expand Up @@ -118,19 +116,19 @@ def hook_method(probe, &block)
rv = nil
# Under Ruby 2.6 we cannot just call super(*args, **kwargs)
# for methods defined via method_missing.
duration = Benchmark.realtime do # steep:ignore
rv = if args.any?
if kwargs.any?
super(*args, **kwargs, &target_block)
else
super(*args, &target_block)
end
elsif kwargs.any?
super(**kwargs, &target_block)
start_time = Core::Utils::Time.get_time
rv = if args.any?
if kwargs.any?
super(*args, **kwargs, &target_block)
else
super(&target_block)
super(*args, &target_block)
end
elsif kwargs.any?
super(**kwargs, &target_block)
else
super(&target_block)
end
duration = Core::Utils::Time.get_time - start_time
# The method itself is not part of the stack trace because
# we are getting the stack trace from outside of the method.
# Add the method in manually as the top frame.
Expand Down

0 comments on commit c841818

Please sign in to comment.