summaryrefslogtreecommitdiff
path: root/lib/gitlab/bitbucket_import/metrics.rb
blob: 25e2d9b211ea011b075eca90f78cef11b19eb508 (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
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

module Gitlab
  module BitbucketImport
    module Metrics
      extend ActiveSupport::Concern

      IMPORTER = :bitbucket_importer

      included do
        prepend Gitlab::Import::Metrics

        Gitlab::Import::Metrics.measure(:execute, metrics: {
          "#{IMPORTER}_imported_projects": {
            type: :counter,
            description: 'The number of imported Bitbucket projects'
          },
          "#{IMPORTER}_total_duration_seconds": {
            type: :histogram,
            labels: { importer: IMPORTER },
            description: 'Total time spent importing Bitbucket projects, in seconds'
          }
        })

        Gitlab::Import::Metrics.measure(:import_issue, metrics: {
          "#{IMPORTER}_imported_issues": {
            type: :counter,
            description: 'The number of imported Bitbucket issues'
          }
        })

        Gitlab::Import::Metrics.measure(:import_pull_request, metrics: {
          "#{IMPORTER}_imported_pull_requests": {
            type: :counter,
            description: 'The number of imported Bitbucket pull requests'
          }
        })
      end
    end
  end
end