summaryrefslogtreecommitdiff
path: root/lib/gitlab/grafana_embed_usage_data.rb
blob: 78a87623e1f63b1b46838ab822a8d81319f46fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module Gitlab
  class GrafanaEmbedUsageData
    class << self
      def issue_count
        # rubocop:disable CodeReuse/ActiveRecord
        Issue.joins('JOIN grafana_integrations USING (project_id)')
          .where("issues.description LIKE '%' || grafana_integrations.grafana_url || '%'")
          .where(grafana_integrations: { enabled: true })
          .count
        # rubocop:enable CodeReuse/ActiveRecord
      end
    end
  end
end