Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions bin/dry-run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions common/lib/dependabot/shared_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require "active_support/notifications"
require "digest"
require "English"
require "excon"
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions common/spec/dependabot/shared_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down