Skip to content

Commit d5f88ea

Browse files
authored
DEBUG-3305 remove dependency on benchmark (#4259)
1 parent 9605f99 commit d5f88ea

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/datadog/di/instrumenter.rb

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable Lint/AssignmentInCondition
3+
require_relative '../core/utils/time'
44

5-
require 'benchmark'
5+
# rubocop:disable Lint/AssignmentInCondition
66

77
module Datadog
88
module DI
@@ -115,22 +115,21 @@ def hook_method(probe, &block)
115115
depth: probe.max_capture_depth || settings.dynamic_instrumentation.max_capture_depth,
116116
attribute_count: probe.max_capture_attribute_count || settings.dynamic_instrumentation.max_capture_attribute_count)
117117
end
118-
rv = nil
118+
start_time = Core::Utils::Time.get_time
119119
# Under Ruby 2.6 we cannot just call super(*args, **kwargs)
120120
# for methods defined via method_missing.
121-
duration = Benchmark.realtime do # steep:ignore
122-
rv = if args.any?
123-
if kwargs.any?
124-
super(*args, **kwargs, &target_block)
125-
else
126-
super(*args, &target_block)
127-
end
128-
elsif kwargs.any?
129-
super(**kwargs, &target_block)
121+
rv = if args.any?
122+
if kwargs.any?
123+
super(*args, **kwargs, &target_block)
130124
else
131-
super(&target_block)
125+
super(*args, &target_block)
132126
end
127+
elsif kwargs.any?
128+
super(**kwargs, &target_block)
129+
else
130+
super(&target_block)
133131
end
132+
duration = Core::Utils::Time.get_time - start_time
134133
# The method itself is not part of the stack trace because
135134
# we are getting the stack trace from outside of the method.
136135
# Add the method in manually as the top frame.

0 commit comments

Comments
 (0)