Commit d6bb2517 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'source-code-endpoint-thresholds' into 'master'

Source code endpoint thresholds

See merge request gitlab-org/gitlab!74058
parents 82ff180f b9c4272b
......@@ -10,6 +10,7 @@ class Projects::BlameController < Projects::ApplicationController
before_action :authorize_download_code!
feature_category :source_code_management
urgency :low, [:show]
def show
@blob = @repository.blob_at(@commit.id, @path)
......
......@@ -40,6 +40,7 @@ class Projects::BlobController < Projects::ApplicationController
track_redis_hll_event :create, :update, name: 'g_edit_by_sfe'
feature_category :source_code_management
urgency :low, [:create, :show, :edit, :update, :diff]
before_action do
push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml)
......
......@@ -14,6 +14,7 @@ class Projects::BranchesController < Projects::ApplicationController
before_action :limit_diverging_commit_counts!, only: [:diverging_commit_counts]
feature_category :source_code_management
urgency :low, [:index, :diverging_commit_counts, :create, :destroy]
def index
respond_to do |format|
......
......@@ -24,6 +24,7 @@ class Projects::CommitController < Projects::ApplicationController
COMMIT_DIFFS_PER_PAGE = 20
feature_category :source_code_management
urgency :low, [:pipelines, :merge_requests, :show]
def show
apply_diff_view_cookie!
......
......@@ -17,6 +17,7 @@ class Projects::CommitsController < Projects::ApplicationController
before_action :set_commits, except: :commits_root
feature_category :source_code_management
urgency :low, [:signatures, :show]
def commits_root
redirect_to project_commits_path(@project, @project.default_branch)
......
......@@ -21,6 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
before_action :validate_refs!
feature_category :source_code_management
urgency :low, [:show, :create, :signatures]
# Diffs may be pretty chunky, the less is better in this endpoint.
# Pagination design guides: https://design.gitlab.com/components/pagination/#behavior
......
......@@ -11,6 +11,7 @@ class Projects::FindFileController < Projects::ApplicationController
before_action :authorize_download_code!
feature_category :source_code_management
urgency :low, [:show, :list]
def show
return render_404 unless @repository.commit(@ref)
......
......@@ -15,6 +15,7 @@ class Projects::ForksController < Projects::ApplicationController
before_action :authorize_fork_namespace!, only: [:create]
feature_category :source_code_management
urgency :low, [:index]
before_action do
push_frontend_feature_flag(:fork_project_form, @project, default_enabled: :yaml)
......
......@@ -12,6 +12,7 @@ class Projects::GraphsController < Projects::ApplicationController
track_redis_hll_event :charts, name: 'p_analytics_repo'
feature_category :source_code_management
urgency :low, [:show]
def show
respond_to do |format|
......
......@@ -11,6 +11,7 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :assign_commit
feature_category :source_code_management
urgency :low, [:show]
def show
@url = project_network_path(@project, @ref, @options.merge(format: :json))
......
......@@ -12,6 +12,7 @@ class Projects::RefsController < Projects::ApplicationController
before_action :authorize_download_code!
feature_category :source_code_management
urgency :low, [:switch, :logs_tree]
def switch
respond_to do |format|
......
......@@ -12,6 +12,7 @@ module Projects
feature_category :source_code_management, [:show, :cleanup]
feature_category :continuous_delivery, [:create_deploy_token]
urgency :low, [:show]
def show
render_show
......
......@@ -11,6 +11,7 @@ class Projects::TagsController < Projects::ApplicationController
before_action :authorize_admin_tag!, only: [:new, :create, :destroy]
feature_category :source_code_management
urgency :low, [:new, :show, :index]
# rubocop: disable CodeReuse/ActiveRecord
def index
......
......@@ -6,6 +6,7 @@ class Projects::TemplatesController < Projects::ApplicationController
before_action :get_template_class
feature_category :source_code_management
urgency :low, [:names]
def index
templates = @template_type.template_subsets(project)
......
......@@ -23,6 +23,7 @@ class Projects::TreeController < Projects::ApplicationController
end
feature_category :source_code_management
urgency :low, [:show]
def show
return render_404 unless @commit
......
......@@ -52,6 +52,7 @@ class ProjectsController < Projects::ApplicationController
feature_category :team_planning, [:preview_markdown, :new_issuable_address]
feature_category :importers, [:export, :remove_export, :generate_new_export, :download_export]
feature_category :code_review, [:unfoldered_environment_names]
urgency :low, [:refs]
def index
redirect_to(current_user ? root_path : explore_root_path)
......
......@@ -13,6 +13,7 @@ module Repositories
# added here as a part of the refactor, will be removed
# https://gitlab.com/gitlab-org/gitlab/-/issues/328692
delegate :deploy_token, :user, to: :authentication_result, allow_nil: true
urgency :medium, [:batch]
def batch
unless objects.present?
......
......@@ -11,6 +11,8 @@ module Repositories
# added here as a part of the refactor, will be removed
# https://gitlab.com/gitlab-org/gitlab/-/issues/328692
delegate :deploy_token, :user, to: :authentication_result, allow_nil: true
urgency :medium, [:download, :upload_authorize]
urgency :low, [:upload_finalize]
def download
lfs_object = LfsObject.find_by_oid(oid)
......
......@@ -11,6 +11,7 @@ class Projects::PathLocksController < Projects::ApplicationController
before_action :check_license
feature_category :source_code_management
urgency :low, [:index]
def index
@path_locks = @project.path_locks.page(params[:page])
......
......@@ -21,7 +21,7 @@ module API
desc 'Get all merge request approval rules' do
success EE::API::Entities::MergeRequestApprovalRule
end
get do
get '/', urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid])
present merge_request.approval_rules, with: EE::API::Entities::MergeRequestApprovalRule, current_user: current_user
......
......@@ -38,7 +38,7 @@ module API
detail 'This feature was introduced in 14.3 behind the :group_merge_request_approval_settings_feature_flag'
success EE::API::Entities::MergeRequestApprovalSettings
end
get do
get '/', urgency: :medium do
not_found! unless ::Feature.enabled?(:group_merge_request_approval_settings_feature_flag, user_project.root_ancestor, default_enabled: :yaml)
group = user_project.group.present? ? user_project.root_ancestor : nil
......
......@@ -29,7 +29,7 @@ module API
detail 'This feature was introduced in 10.6'
success EE::API::Entities::ApprovalSettings
end
get '/' do
get '/', urgency: :low do
present user_project.present(current_user: current_user), with: EE::API::Entities::ApprovalSettings
end
......
......@@ -41,7 +41,7 @@ module API
optional :page_token, type: String, desc: 'Name of branch to start the paginaition from'
end
get ':id/repository/branches' do
get ':id/repository/branches', urgency: :low do
ff_enabled = Feature.enabled?(:api_caching_rate_limit_branches, user_project, default_enabled: :yaml)
cache_action_if(ff_enabled, [user_project, :branches, current_user, declared_params], expires_in: 30.seconds) do
......@@ -86,7 +86,7 @@ module API
head do
user_project.repository.branch_exists?(params[:branch]) ? no_content! : not_found!
end
get do
get '/', urgency: :low do
branch = find_branch!(params[:branch])
present branch, with: Entities::Branch, current_user: current_user, project: user_project
......
......@@ -27,7 +27,7 @@ module API
params do
requires :id, type: String, desc: 'The ID of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS, urgency: :low do
desc 'Get a project repository commits' do
success Entities::Commit
end
......@@ -43,7 +43,7 @@ module API
optional :trailers, type: Boolean, desc: 'Parse and include Git trailers for every commit', default: false
use :pagination
end
get ':id/repository/commits' do
get ':id/repository/commits', urgency: :low do
path = params[:path]
before = params[:until]
after = params[:since]
......@@ -169,7 +169,7 @@ module API
requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag'
use :pagination
end
get ':id/repository/commits/:sha/diff', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do
get ':id/repository/commits/:sha/diff', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS, urgency: :low do
commit = user_project.commit(params[:sha])
not_found! 'Commit' unless commit
......@@ -295,7 +295,7 @@ module API
optional :type, type: String, values: %w[branch tag all], default: 'all', desc: 'Scope'
use :pagination
end
get ':id/repository/commits/:sha/refs', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do
get ':id/repository/commits/:sha/refs', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS, urgency: :low do
commit = user_project.commit(params[:sha])
not_found!('Commit') unless commit
......@@ -363,7 +363,7 @@ module API
requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag on which to find Merge Requests'
use :pagination
end
get ':id/repository/commits/:sha/merge_requests', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do
get ':id/repository/commits/:sha/merge_requests', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS, urgency: :low do
authorize! :read_merge_request, user_project
commit = user_project.commit(params[:sha])
......
......@@ -122,7 +122,7 @@ module API
requires :file_path, type: String, file_path: true, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb'
optional :ref, type: String, desc: 'The name of branch, tag or commit', allow_blank: false
end
head ":id/repository/files/:file_path/raw", requirements: FILE_ENDPOINT_REQUIREMENTS do
head ":id/repository/files/:file_path/raw", requirements: FILE_ENDPOINT_REQUIREMENTS, urgency: :low do
assign_file_vars!
set_http_headers(blob_data)
......@@ -133,7 +133,7 @@ module API
requires :file_path, type: String, file_path: true, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb'
optional :ref, type: String, desc: 'The name of branch, tag or commit', allow_blank: false
end
get ":id/repository/files/:file_path/raw", requirements: FILE_ENDPOINT_REQUIREMENTS do
get ":id/repository/files/:file_path/raw", requirements: FILE_ENDPOINT_REQUIREMENTS, urgency: :low do
assign_file_vars!
no_cache_headers
......@@ -147,7 +147,7 @@ module API
requires :file_path, type: String, file_path: true, desc: 'The url encoded path to the file. Ex. lib%2Fclass%2Erb'
requires :ref, type: String, desc: 'The name of branch, tag or commit', allow_blank: false
end
head ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS do
head ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS, urgency: :low do
assign_file_vars!
set_http_headers(blob_data)
......@@ -174,7 +174,7 @@ module API
params do
use :extended_file_params
end
post ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS do
post ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS, urgency: :low do
authorize! :push_code, user_project
file_params = declared_params(include_missing: false)
......@@ -192,7 +192,7 @@ module API
params do
use :extended_file_params
end
put ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS do
put ":id/repository/files/:file_path", requirements: FILE_ENDPOINT_REQUIREMENTS, urgency: :low do
authorize! :push_code, user_project
file_params = declared_params(include_missing: false)
......
......@@ -145,7 +145,7 @@ module API
check_allowed(params)
end
post "/lfs_authenticate", feature_category: :source_code_management do
post "/lfs_authenticate", feature_category: :source_code_management, urgency: :high do
not_found! unless container&.lfs_enabled?
status 200
......
......@@ -24,7 +24,7 @@ module API
requires :oid, type: String, desc: 'The object ID to query'
requires :gl_repository, type: String, desc: "Project identifier (e.g. project-1)"
end
get "/" do
get "/", urgency: :high do
lfs_object = find_lfs_object(params[:oid])
not_found! unless lfs_object
......
......@@ -25,7 +25,7 @@ module API
# Examples:
# GET /projects/:id/merge_requests/:merge_request_iid/approvals
desc 'List approvals for merge request'
get 'approvals' do
get 'approvals', urgency: :low do
not_found!("Merge Request") unless can?(current_user, :read_merge_request, user_project)
merge_request = find_merge_request_with_access(params[:merge_request_iid])
......@@ -47,7 +47,7 @@ module API
use :ee_approval_params
end
post 'approve' do
post 'approve', urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid], :approve_merge_request)
check_sha_param!(params, merge_request)
......@@ -63,7 +63,7 @@ module API
end
desc 'Remove an approval from a merge request'
post 'unapprove' do
post 'unapprove', urgency: :low do
merge_request = find_merge_request_with_access(params[:merge_request_iid], :approve_merge_request)
success = ::MergeRequests::RemoveApprovalService
......
......@@ -404,7 +404,7 @@ module API
use :collection_params
use :with_custom_attributes
end
get ':id/forks', feature_category: :source_code_management do
get ':id/forks', feature_category: :source_code_management, urgency: :low do
forks = ForkProjectsFinder.new(user_project, params: project_finder_params, current_user: current_user).execute
present_projects forks, request_scope: user_project
......@@ -514,7 +514,7 @@ module API
end
desc 'Get languages in project repository'
get ':id/languages', feature_category: :source_code_management do
get ':id/languages', feature_category: :source_code_management, urgency: :medium do
::Projects::RepositoryLanguagesService
.new(user_project, current_user)
.execute.to_h { |lang| [lang.name, lang.share] }
......
......@@ -91,7 +91,7 @@ module API
requires :name, type: String, desc: 'The name of the protected branch'
end
# rubocop: disable CodeReuse/ActiveRecord
delete ':id/protected_branches/:name', requirements: BRANCH_ENDPOINT_REQUIREMENTS do
delete ':id/protected_branches/:name', requirements: BRANCH_ENDPOINT_REQUIREMENTS, urgency: :low do
protected_branch = user_project.protected_branches.find_by!(name: params[:name])
destroy_conditionally!(protected_branch) do
......
......@@ -79,7 +79,7 @@ module API
optional :page_token, type: String, desc: 'Record from which to start the keyset pagination'
end
end
get ':id/repository/tree' do
get ':id/repository/tree', urgency: :low do
tree_finder = ::Repositories::TreeFinder.new(user_project, declared_params(include_missing: false))
not_found!("Tree") unless tree_finder.commit_exists?
......@@ -144,7 +144,7 @@ module API
optional :from_project_id, type: String, desc: 'The project to compare from'
optional :straight, type: Boolean, desc: 'Comparison method, `true` for direct comparison between `from` and `to` (`from`..`to`), `false` to compare using merge base (`from`...`to`)', default: false
end
get ':id/repository/compare' do
get ':id/repository/compare', urgency: :low do
ff_enabled = Feature.enabled?(:api_caching_rate_limit_repository_compare, user_project, default_enabled: :yaml)
target_project = fetch_target_project(current_user, user_project, params)
......
......@@ -23,7 +23,7 @@ module API
optional :search, type: String, desc: 'Return list of tags matching the search criteria'
use :pagination
end
get ':id/repository/tags', feature_category: :source_code_management do
get ':id/repository/tags', feature_category: :source_code_management, urgency: :low do
tags = ::TagsFinder.new(user_project.repository,
sort: "#{params[:order_by]}_#{params[:sort]}",
search: params[:search]).execute
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment