Welcome to mirror list, hosted at ThFree Co, Russian Federation.

log_query_complexity.rb « query_analyzers « graphql « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95db130dbfc68abb6d652de44ce9a859334d5f57 (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
              Rails.logger.info("[GraphQL Query Complexity] #{complexity}  | admin? #{query.context[:current_user]&.admin?}")
            end
          end
        end
      end
    end
  end
end