diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index b1e0573abdf..b15c9dc5304 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -639d1a25d4de3e2a60cf10e8c3afc0121c27c317 +3f6bb782a56a34cca7d7c45493119dc2c457b303 diff --git a/app/assets/javascripts/clusters_list/components/clusters.vue b/app/assets/javascripts/clusters_list/components/clusters.vue index 9c330045596..7fb3aa3ff7e 100644 --- a/app/assets/javascripts/clusters_list/components/clusters.vue +++ b/app/assets/javascripts/clusters_list/components/clusters.vue @@ -57,7 +57,7 @@ export default { 'totalClusters', ]), contentAlignClasses() { - return 'gl-display-flex gl-align-items-center gl-justify-content-end gl-justify-content-md-start'; + return 'gl-display-flex gl-align-items-center gl-justify-content-end gl-md-justify-content-start'; }, currentPage: { get() { diff --git a/app/assets/javascripts/terraform/components/states_table.vue b/app/assets/javascripts/terraform/components/states_table.vue index d066834540f..d3c373e7db1 100644 --- a/app/assets/javascripts/terraform/components/states_table.vue +++ b/app/assets/javascripts/terraform/components/states_table.vue @@ -128,7 +128,7 @@ export default { >
diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb index d71ee671b8d..4a3ef3711a5 100644 --- a/lib/gitlab/metrics/samplers/ruby_sampler.rb +++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb @@ -7,22 +7,20 @@ module Gitlab DEFAULT_SAMPLING_INTERVAL_SECONDS = 60 GC_REPORT_BUCKETS = [0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 1].freeze - def initialize(...) + def initialize(prefix: nil, **options) + @prefix = prefix + GC::Profiler.clear metrics[:process_start_time_seconds].set(labels, Time.now.to_i) - super(...) + super(**options) end def metrics @metrics ||= init_metrics end - def with_prefix(prefix, name) - "ruby_#{prefix}_#{name}".to_sym - end - def to_doc_string(name) name.to_s.humanize end @@ -33,19 +31,19 @@ module Gitlab def init_metrics metrics = { - file_descriptors: ::Gitlab::Metrics.gauge(with_prefix(:file, :descriptors), 'File descriptors used', labels), - process_cpu_seconds_total: ::Gitlab::Metrics.gauge(with_prefix(:process, :cpu_seconds_total), 'Process CPU seconds total'), - process_max_fds: ::Gitlab::Metrics.gauge(with_prefix(:process, :max_fds), 'Process max fds'), - process_resident_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :resident_memory_bytes), 'Memory used (RSS)', labels), - process_unique_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :unique_memory_bytes), 'Memory used (USS)', labels), - process_proportional_memory_bytes: ::Gitlab::Metrics.gauge(with_prefix(:process, :proportional_memory_bytes), 'Memory used (PSS)', labels), - process_start_time_seconds: ::Gitlab::Metrics.gauge(with_prefix(:process, :start_time_seconds), 'Process start time seconds'), - sampler_duration: ::Gitlab::Metrics.counter(with_prefix(:sampler, :duration_seconds_total), 'Sampler time', labels), - gc_duration_seconds: ::Gitlab::Metrics.histogram(with_prefix(:gc, :duration_seconds), 'GC time', labels, GC_REPORT_BUCKETS) + file_descriptors: ::Gitlab::Metrics.gauge(metric_name(:file, :descriptors), 'File descriptors used', labels), + process_cpu_seconds_total: ::Gitlab::Metrics.gauge(metric_name(:process, :cpu_seconds_total), 'Process CPU seconds total'), + process_max_fds: ::Gitlab::Metrics.gauge(metric_name(:process, :max_fds), 'Process max fds'), + process_resident_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :resident_memory_bytes), 'Memory used (RSS)', labels), + process_unique_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :unique_memory_bytes), 'Memory used (USS)', labels), + process_proportional_memory_bytes: ::Gitlab::Metrics.gauge(metric_name(:process, :proportional_memory_bytes), 'Memory used (PSS)', labels), + process_start_time_seconds: ::Gitlab::Metrics.gauge(metric_name(:process, :start_time_seconds), 'Process start time seconds'), + sampler_duration: ::Gitlab::Metrics.counter(metric_name(:sampler, :duration_seconds_total), 'Sampler time', labels), + gc_duration_seconds: ::Gitlab::Metrics.histogram(metric_name(:gc, :duration_seconds), 'GC time', labels, GC_REPORT_BUCKETS) } GC.stat.keys.each do |key| - metrics[key] = ::Gitlab::Metrics.gauge(with_prefix(:gc_stat, key), to_doc_string(key), labels) + metrics[key] = ::Gitlab::Metrics.gauge(metric_name(:gc_stat, key), to_doc_string(key), labels) end metrics @@ -65,6 +63,12 @@ module Gitlab private + def metric_name(group, metric) + name = "ruby_#{group}_#{metric}" + name = "#{@prefix}_#{name}" if @prefix.present? + name.to_sym + end + def sample_gc # Observe all GC samples sample_gc_reports.each do |report| diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 4adb76122de..7a5af14a1ba 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -31803,6 +31803,9 @@ msgstr "" msgid "SecurityOrchestration|Scan result" msgstr "" +msgid "SecurityOrchestration|Scan result policies can only be created by project owners." +msgstr "" + msgid "SecurityOrchestration|Scan to be performed %{cadence}" msgstr "" @@ -31848,7 +31851,7 @@ msgstr "" msgid "SecurityOrchestration|Unlinking a security project removes all policies stored in the linked security project. Save to confirm this action." msgstr "" -msgid "SecurityOrchestration|Update scan execution policies" +msgid "SecurityOrchestration|Update scan policies" msgstr "" msgid "SecurityOrchestration|a" diff --git a/metrics_server/metrics_server.rb b/metrics_server/metrics_server.rb index 122a4e4fc1e..68d39eaf77c 100644 --- a/metrics_server/metrics_server.rb +++ b/metrics_server/metrics_server.rb @@ -50,7 +50,7 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass # a race where not all Prometheus db files will be visible to the exporter, resulting # in missing metrics. # Warming up ensures that these files exist prior to the exporter starting up. - Gitlab::Metrics::Samplers::RubySampler.initialize_instance(warmup: true).start + Gitlab::Metrics::Samplers::RubySampler.initialize_instance(prefix: name, warmup: true).start exporter_class = "Gitlab::Metrics::Exporter::#{@target.camelize}Exporter".constantize settings = Settings.new(Settings.monitoring[name]) diff --git a/package.json b/package.json index 617f661e454..54618cd9385 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@gitlab/favicon-overlay": "2.0.0", "@gitlab/svgs": "2.2.0", "@gitlab/tributejs": "1.0.0", - "@gitlab/ui": "32.68.0", + "@gitlab/ui": "33.0.0", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "6.1.4-1", "@rails/ujs": "6.1.4-1", diff --git a/qa/qa/resource/protected_branch.rb b/qa/qa/resource/protected_branch.rb index 7db6450acf8..062d4e9f3d8 100644 --- a/qa/qa/resource/protected_branch.rb +++ b/qa/qa/resource/protected_branch.rb @@ -61,6 +61,8 @@ module QA end def fabricate_via_api! + resource_web_url(api_get) + rescue ResourceNotFoundError populate_new_branch_if_required super @@ -75,7 +77,11 @@ module QA end def api_delete_path - "/projects/#{project.id}/protected_branches/#{branch_name}" + api_get_path + end + + def api_put_path + api_get_path end def api_post_path @@ -107,6 +113,16 @@ module QA # this particular resource does not expose a web_url property end + def set_require_code_owner_approval(require = true) + response = patch(Runtime::API::Request.new(api_client, api_put_path).url, { code_owner_approval_required: require }) + return if response.code == HTTP_STATUS_OK + + raise( + ResourceUpdateFailedError, + "Could not update code_owner_approval_required to #{require}. Request returned (#{response.code}): `#{response}`." + ) + end + class Roles NO_ONE = { description: 'No one', access_level: 0 }.freeze DEVS_AND_MAINTAINERS = { description: 'Developers + Maintainers', access_level: 30 }.freeze diff --git a/qa/qa/support/api.rb b/qa/qa/support/api.rb index 663761805ee..976188e45c6 100644 --- a/qa/qa/support/api.rb +++ b/qa/qa/support/api.rb @@ -44,6 +44,18 @@ module QA end end + def patch(url, payload = nil) + with_retry_on_too_many_requests do + RestClient::Request.execute( + method: :patch, + url: url, + payload: payload, + verify_ssl: false) + rescue RestClient::ExceptionWithResponse => e + return_response_or_raise(e) + end + end + def put(url, payload = nil) with_retry_on_too_many_requests do RestClient::Request.execute( diff --git a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb index 40a8be8202a..4bbad9bf3e5 100644 --- a/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb +++ b/qa/spec/support/shared_examples/merge_with_code_owner_shared_examples.rb @@ -31,19 +31,13 @@ module QA end # Require approval from code owners on the default branch - # The default branch is already protected, and we can't update a protected branch via the API (yet) - # so we unprotect it first and then protect it again with the desired parameters - Resource::ProtectedBranch.unprotect_via_api! do |protected_branch| - protected_branch.project = project - protected_branch.branch_name = project.default_branch - end - - Resource::ProtectedBranch.fabricate_via_api! do |protected_branch| - protected_branch.project = project - protected_branch.branch_name = project.default_branch - protected_branch.new_branch = false - protected_branch.require_code_owner_approval = true + protected_branch = Resource::ProtectedBranch.fabricate_via_api! do |branch| + branch.project = project + branch.branch_name = project.default_branch + branch.new_branch = false + branch.require_code_owner_approval = true end + protected_branch.set_require_code_owner_approval # Push a change to the file with a CODEOWNERS rule Resource::Repository::Push.fabricate! do |push| diff --git a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb index a4877208bcf..dfae5aa6784 100644 --- a/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb +++ b/spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb @@ -18,6 +18,20 @@ RSpec.describe Gitlab::Metrics::Samplers::RubySampler do expect(sampler.metrics[:process_start_time_seconds].get).to eq(Time.now.to_i) end end + + context 'when not setting a prefix' do + it 'does not prepend metrics with that prefix' do + expect(sampler.metrics[:process_start_time_seconds].name).to eq(:ruby_process_start_time_seconds) + end + end + + context 'when using custom prefix' do + let(:sampler) { described_class.new(prefix: 'custom') } + + it 'prepends metrics with that prefix' do + expect(sampler.metrics[:process_start_time_seconds].name).to eq(:custom_ruby_process_start_time_seconds) + end + end end describe '#sample' do diff --git a/yarn.lock b/yarn.lock index 51e4efcf5c4..0cc3a1bbf5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -924,10 +924,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/tributejs/-/tributejs-1.0.0.tgz#672befa222aeffc83e7d799b0500a7a4418e59b8" integrity sha512-nmKw1+hB6MHvlmPz63yPwVs1qQkycHwsKgxpEbzmky16Y6mL4EJMk3w1b8QlOAF/AIAzjCERPhe/R4MJiohbZw== -"@gitlab/ui@32.68.0": - version "32.68.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-32.68.0.tgz#f7c4ebd2f9b3635db16589b289fdda149ca1cbcc" - integrity sha512-rTd0+bNBjPvL1ZMfGEHNoBSZwumu6DMQLBwtPhUaj288nAB4K2xibdhFmsm1yqhnW04VNLyBs9FqKdXRQqFttA== +"@gitlab/ui@33.0.0": + version "33.0.0" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-33.0.0.tgz#d41f59e9acc19af84a80fa14c4ac4eff0b8f6ba5" + integrity sha512-os2PmiOIdzlYIv0GoFtvTmBXhl8B4rnzPgibHUOiMZf8n9Oye8LNs9+zA1fk5PRur/SVwmS5+0hIFH7Dyqt9hw== dependencies: "@babel/standalone" "^7.0.0" bootstrap-vue "2.20.1"