diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 18:08:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 18:08:20 +0300 |
commit | 78782cd1eb5273265668ca3e438bb8cbb1344004 (patch) | |
tree | 63e9715611d41a0c9dac52aca6613c1fc2af7b58 /vendor | |
parent | b161512b300e70c1e786dd299867dad284e11019 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'vendor')
4 files changed, 14 insertions, 28 deletions
diff --git a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/agent.rb b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/agent.rb index b7400a0081c..2c538d5224e 100644 --- a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/agent.rb +++ b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/agent.rb @@ -9,7 +9,8 @@ module CloudProfilerAgent GoogleCloudProfiler = ::Google::Cloud::Profiler::V2 PROFILE_TYPES = { - CPU: :cpu + CPU: :cpu, + WALL: :wall }.freeze # This regexp will ensure the service name is valid. # See https://cloud.google.com/ruby/docs/reference/google-cloud-profiler-v2/latest/Google-Cloud-Profiler-V2-Deployment#Google__Cloud__Profiler__V2__Deployment_target_instance_ @@ -66,6 +67,11 @@ module CloudProfilerAgent return if @thread&.alive? @thread = Thread.new do + logger.info( + gcp_ruby_status: "Created new agent thread", + **log_labels + ) + Looper.new(logger: logger, log_labels: log_labels).run do google_profile = create_google_profile google_profile = profile_app(google_profile) diff --git a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/looper.rb b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/looper.rb index de5fe3fe522..cd9502de435 100644 --- a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/looper.rb +++ b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/looper.rb @@ -49,6 +49,12 @@ module CloudProfilerAgent begin yield rescue ::Google::Cloud::Error => e + logger.error( + gcp_ruby_status: "error", + error: e.inspect, + **log_labels + ) + backoff = backoff_duration(e) if backoff.nil? iteration_time = @max_iteration_sec diff --git a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/pprof_builder.rb b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/pprof_builder.rb index a2ca3323d98..0f2ff71c791 100644 --- a/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/pprof_builder.rb +++ b/vendor/gems/cloud_profiler_agent/lib/cloud_profiler_agent/pprof_builder.rb @@ -145,7 +145,7 @@ module CloudProfilerAgent @profile.fetch(:frames, []).each do |location_id, location| message.function.push(Perftools::Profiles::Function.new( id: location_id, - name: @string_map.add(cleaned_name(location.fetch(:name))), + name: @string_map.add(location.fetch(:name)), filename: @string_map.add(location.fetch(:file)), start_line: location.fetch(:line, nil) )) @@ -161,13 +161,6 @@ module CloudProfilerAgent )) end end - - def cleaned_name(name) - # Google Cloud Profiler has trouble identifying class structure in Ruby. It prefers everything separated by a - # dot as it is in for example Golang. - # We have to substitute `ActionView::Template#render` to `ActionView.Template.render` - name.gsub!(/::|#/, '.') || name - end end # The pprof format has one table of strings, and objects that need strings diff --git a/vendor/gems/cloud_profiler_agent/spec/cloud_profiler_agent/pprof_builder_spec.rb b/vendor/gems/cloud_profiler_agent/spec/cloud_profiler_agent/pprof_builder_spec.rb index 02d6a7a70c2..5c94a8e1e44 100644 --- a/vendor/gems/cloud_profiler_agent/spec/cloud_profiler_agent/pprof_builder_spec.rb +++ b/vendor/gems/cloud_profiler_agent/spec/cloud_profiler_agent/pprof_builder_spec.rb @@ -27,25 +27,6 @@ RSpec.describe CloudProfilerAgent::PprofBuilder, feature_category: :application_ # assertions about the message directly. let(:message) { subject.message } - context '#process_frames' do - let(:profile) { load_profile(:cpu) } - let(:string_map) { subject.instance_variable_get(:@string_map) } - - it 'converts method names to dot notation' do - original_frame_name = profile[:frames].to_a[0].last[:name] - expect(original_frame_name).to eq("Prime#prime_division") - second_original_frame_name = profile[:frames].to_a[1].last[:name] - expect(second_original_frame_name).to eq("Prime::PseudoPrimeGenerator#each") - - message - - cleaned_frame_name = string_map.strings[4] # the first 4 items are profile metadata - expect(cleaned_frame_name).to eq("Prime.prime_division") - second_cleaned_frame_name = string_map.strings[6] # 5 is the file location - expect(second_cleaned_frame_name).to eq("Prime.PseudoPrimeGenerator.each") - end - end - context 'with :cpu profile' do let(:profile) { load_profile(:cpu) } |