summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/calls_gitaly.rb
blob: 40cd74a34f2ef2a76baa80a6e8154a4f0960ab83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Gitlab
  module Graphql
    # Wraps the field resolution to count Gitaly calls before and after.
    # Raises an error if the field calls Gitaly but hadn't declared such.
    module CallsGitaly
      extend ActiveSupport::Concern

      def self.use(schema_definition)
        schema_definition.instrument(:field, Gitlab::Graphql::CallsGitaly::Instrumentation.new, after_built_ins: true)
      end
    end
  end
end