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

unique_active_users_metric.rb « instrumentations « metrics « usage « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9da30db05dd7aa67d172f3dc2e31521822c7f815 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Gitlab
  module Usage
    module Metrics
      module Instrumentations
        class UniqueActiveUsersMetric < DatabaseMetric
          operation :count
          relation { ::User.active }

          metric_options do
            {
              batch_size: 10_000
            }
          end

          def time_constraints
            case time_frame
            when '28d'
              monthly_time_range_db_params(column: :last_activity_on)
            else
              super
            end
          end
        end
      end
    end
  end
end