summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 15:06:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 15:06:20 +0000
commit4204cf308596e0e26f578a6e2da88f49c0f4aad9 (patch)
tree644447bcb576a459e079318b06712b7c89416e2b /lib
parentcd4cb29b2c304f00d238ee72fe40c767cb3e2675 (diff)
downloadgitlab-ce-4204cf308596e0e26f578a6e2da88f49c0f4aad9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/data_builder/pipeline.rb1
-rw-r--r--lib/gitlab/grafana_embed_usage_data.rb16
-rw-r--r--lib/gitlab/usage_data.rb1
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/data_builder/pipeline.rb b/lib/gitlab/data_builder/pipeline.rb
index da3d6c47431..8e699de8164 100644
--- a/lib/gitlab/data_builder/pipeline.rb
+++ b/lib/gitlab/data_builder/pipeline.rb
@@ -61,6 +61,7 @@ module Gitlab
finished_at: build.finished_at,
when: build.when,
manual: build.action?,
+ allow_failure: build.allow_failure,
user: build.user.try(:hook_attrs),
runner: build.runner && runner_hook_attrs(build.runner),
artifacts_file: {
diff --git a/lib/gitlab/grafana_embed_usage_data.rb b/lib/gitlab/grafana_embed_usage_data.rb
new file mode 100644
index 00000000000..78a87623e1f
--- /dev/null
+++ b/lib/gitlab/grafana_embed_usage_data.rb
@@ -0,0 +1,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
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index b6effac25c6..a0ff34c76e2 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -84,6 +84,7 @@ module Gitlab
issues: count(Issue),
issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue),
issues_using_zoom_quick_actions: count(ZoomMeeting.select(:issue_id).distinct),
+ issues_with_embedded_grafana_charts_approx: ::Gitlab::GrafanaEmbedUsageData.issue_count,
keys: count(Key),
label_lists: count(List.label),
lfs_objects: count(LfsObject),