web_ide_counter.rb 870 Bytes
Newer Older
1 2 3 4 5 6 7 8
# frozen_string_literal: true

module Gitlab
  module UsageDataCounters
    class WebIdeCounter
      extend RedisCounter

      COMMITS_COUNT_KEY = 'WEB_IDE_COMMITS_COUNT'
9 10
      MERGE_REQUEST_COUNT_KEY = 'WEB_IDE_MERGE_REQUESTS_COUNT'
      VIEWS_COUNT_KEY = 'WEB_IDE_VIEWS_COUNT'
11 12 13 14 15 16 17 18 19

      class << self
        def increment_commits_count
          increment(COMMITS_COUNT_KEY)
        end

        def total_commits_count
          total_count(COMMITS_COUNT_KEY)
        end
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

        def increment_merge_requests_count
          increment(MERGE_REQUEST_COUNT_KEY)
        end

        def total_merge_requests_count
          total_count(MERGE_REQUEST_COUNT_KEY)
        end

        def increment_views_count
          increment(VIEWS_COUNT_KEY)
        end

        def total_views_count
          total_count(VIEWS_COUNT_KEY)
        end
36 37 38 39
      end
    end
  end
end