summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/query_analyzers/log_query_complexity.rb
blob: d3e2194635768c1d3b877b40cdf1689f5570cd33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  module Graphql
    module QueryAnalyzers
      class LogQueryComplexity
        class << self
          def analyzer
            GraphQL::Analysis::QueryComplexity.new do |query, complexity|
              # temporary until https://gitlab.com/gitlab-org/gitlab-ce/issues/59587
              GraphqlLogger.info("[Query Complexity] #{complexity}  | admin? #{query.context[:current_user]&.admin?}")
            end
          end
        end
      end
    end
  end
end