summaryrefslogtreecommitdiff
path: root/lib/api/usage_data_queries.rb
blob: fe972942111864e1c53aaaca072ae04286aac401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module API
  class UsageDataQueries < ::API::Base
    before { authenticated_as_admin! }

    feature_category :service_ping
    urgency :low

    namespace 'usage_data' do
      before do
        not_found! unless Feature.enabled?(:usage_data_queries_api, type: :ops)
      end

      desc 'Get raw SQL queries for usage data SQL metrics' do
        detail 'This feature was introduced in GitLab 13.11.'
      end

      get 'queries' do
        Gitlab::QueryLimiting.disable!('https://gitlab.com/gitlab-org/gitlab/-/issues/325534')

        queries = Gitlab::Usage::ServicePingReport.for(output: :metrics_queries)

        present queries
      end
    end
  end
end