debian-mirror-gitlab/lib/api/usage_data_queries.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
897 B
Ruby
Raw Normal View History

2021-04-29 21:17:54 +05:30
# frozen_string_literal: true
module API
class UsageDataQueries < ::API::Base
before { authenticated_as_admin! }
2021-09-30 23:02:18 +05:30
feature_category :service_ping
2022-07-16 23:28:13 +05:30
urgency :low
2021-04-29 21:17:54 +05:30
namespace 'usage_data' do
before do
2022-07-16 23:28:13 +05:30
not_found! unless Feature.enabled?(:usage_data_queries_api, type: :ops)
2021-04-29 21:17:54 +05:30
end
desc 'Get raw SQL queries for usage data SQL metrics' do
detail 'This feature was introduced in GitLab 13.11.'
2023-03-04 22:38:38 +05:30
success code: 200
failure [
{ code: 401, message: 'Unauthorized' },
{ code: 403, message: 'Forbidden' },
{ code: 404, message: 'Not Found' }
]
2021-04-29 21:17:54 +05:30
end
get 'queries' do
Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/325534')
2022-04-04 11:22:00 +05:30
queries = Gitlab::Usage::ServicePingReport.for(output: :metrics_queries)
2021-04-29 21:17:54 +05:30
present queries
end
end
end
end