diff options
author | Rémy Coutable <remy@rymai.me> | 2019-04-04 15:39:51 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-04-04 15:39:51 +0000 |
commit | 520c120f7c96eb69e36878bd0865df3cefac98a3 (patch) | |
tree | 401e90826a592782b2f590e0a5f015c99a3502bc /lib | |
parent | 94e6cc52bee1a67e830bc3f18aeb57930d0815a7 (diff) | |
parent | f458c561070d754cd546b07caf60dfa7ffb06293 (diff) | |
download | gitlab-ce-520c120f7c96eb69e36878bd0865df3cefac98a3.tar.gz |
Merge branch '58405-basic-limiting-complexity-of-graphql-queries' into 'master'
Basic limiting complexity of GraphQL queries
Closes #58405
See merge request gitlab-org/gitlab-ce!26629
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/graphql/query_analyzers/log_query_complexity.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/query_analyzers/log_query_complexity.rb b/lib/gitlab/graphql/query_analyzers/log_query_complexity.rb new file mode 100644 index 00000000000..95db130dbfc --- /dev/null +++ b/lib/gitlab/graphql/query_analyzers/log_query_complexity.rb @@ -0,0 +1,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 |