Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEBUG-3305 remove dependency on benchmark #4259

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions lib/datadog/di/instrumenter.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

# rubocop:disable Lint/AssignmentInCondition
require_relative '../core/utils/time'

require 'benchmark'
# rubocop:disable Lint/AssignmentInCondition

module Datadog
module DI
Expand Down Expand Up @@ -115,22 +115,21 @@ def hook_method(probe, &block)
depth: probe.max_capture_depth || settings.dynamic_instrumentation.max_capture_depth,
attribute_count: probe.max_capture_attribute_count || settings.dynamic_instrumentation.max_capture_attribute_count)
end
rv = nil
start_time = Core::Utils::Time.get_time
# 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)
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
Loading