diff options
Diffstat (limited to 'lib/gitlab/usage/metrics/instrumentations/count_issues_created_manually_from_alerts_metric.rb')
-rw-r--r-- | lib/gitlab/usage/metrics/instrumentations/count_issues_created_manually_from_alerts_metric.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/usage/metrics/instrumentations/count_issues_created_manually_from_alerts_metric.rb b/lib/gitlab/usage/metrics/instrumentations/count_issues_created_manually_from_alerts_metric.rb new file mode 100644 index 00000000000..e6093691f48 --- /dev/null +++ b/lib/gitlab/usage/metrics/instrumentations/count_issues_created_manually_from_alerts_metric.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Gitlab + module Usage + module Metrics + module Instrumentations + class CountIssuesCreatedManuallyFromAlertsMetric < DatabaseMetric + operation :count + + start { Issue.minimum(:id) } + finish { Issue.maximum(:id) } + + cache_start_and_finish_as :issue + + relation do + Issue.with_alert_management_alerts.not_authored_by(::User.alert_bot) + end + + def value + return FALLBACK if Gitlab.com? + + super + end + end + end + end + end +end |