diff --git a/bin/dry-run.rb b/bin/dry-run.rb index 59fe4b525fd..0c25c1483c1 100755 --- a/bin/dry-run.rb +++ b/bin/dry-run.rb @@ -461,6 +461,14 @@ def handle_dependabot_error(error:, dependency:) StackProf.start(raw: true) if $options[:profile] + +$network_trace_count = 0 +ActiveSupport::Notifications.subscribe(/excon.request/) do |*args| + $network_trace_count += 1 + payload = args.last + puts "🌍 #{payload[:scheme]}//#{payload[:host]}:#{payload[:port]}#{payload[:path]}" +end + $source = Dependabot::Source.new( provider: $options[:provider], repo: $repo_name, @@ -774,6 +782,8 @@ def security_fix?(dependency) StackProf.stop if $options[:profile] StackProf.results("tmp/stackprof-#{Time.now.strftime('%Y-%m-%d-%H:%M')}.dump") if $options[:profile] +puts "🌍 Total requests made: '#{$network_trace_count}'" + # rubocop:enable Metrics/BlockLength # rubocop:enable Style/GlobalVars diff --git a/common/lib/dependabot/shared_helpers.rb b/common/lib/dependabot/shared_helpers.rb index 6068c33b0c0..3609a04ce83 100644 --- a/common/lib/dependabot/shared_helpers.rb +++ b/common/lib/dependabot/shared_helpers.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "active_support/notifications" require "digest" require "English" require "excon" @@ -150,6 +151,7 @@ def self.excon_defaults(options = nil) options ||= {} headers = options.delete(:headers) { + instrumentor: ActiveSupport::Notifications, connect_timeout: 5, write_timeout: 5, read_timeout: 20, diff --git a/common/spec/dependabot/shared_helpers_spec.rb b/common/spec/dependabot/shared_helpers_spec.rb index 5206652579d..fa54077f24c 100644 --- a/common/spec/dependabot/shared_helpers_spec.rb +++ b/common/spec/dependabot/shared_helpers_spec.rb @@ -301,6 +301,7 @@ def existing_tmp_folders it "includes the defaults" do expect(subject).to eq( + instrumentor: ActiveSupport::Notifications, connect_timeout: 5, write_timeout: 5, read_timeout: 20,