null_metric.rb 406 Bytes
Newer Older
1 2 3
module Gitlab
  module Metrics
    # Mocks ::Prometheus::Client::Metric and all derived metrics
4 5 6 7 8 9
    class NullMetric
      def method_missing(name, *args, &block)
        nil
      end

      # these methods shouldn't be called when metrics are disabled
10 11 12 13 14 15 16 17 18 19
      def get(*args)
        raise NotImplementedError
      end

      def values(*args)
        raise NotImplementedError
      end
    end
  end
end