Skip to content
Snippets Groups Projects

POC for ci analytics on ClickHouse

Closed Vladimir Shushlin requested to merge vshushlin/runner-ch-poc into master
Files
4
+ 2
0
@@ -174,6 +174,8 @@ class Build < Ci::Processable
scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where("#{quoted_table_name}.id = #{Ci::BuildTraceChunk.quoted_table_name}.build_id").select(1)) }
scope :with_stale_live_trace, -> { with_live_trace.finished_before(12.hours.ago) }
scope :finished_before, -> (date) { finished.where('finished_at < ?', date) }
# TODO: add index to facilitate this query (state, finished_at, id)
scope :finished_after, -> (finished_at, id = nil) { finished.where('finished_at > ?', finished_at).or(finished.where('finished_at = ? AND id > ?', finished_at, id)) }
scope :license_management_jobs, -> { where(name: %i(license_management license_scanning)) } # handle license rename https://gitlab.com/gitlab-org/gitlab/issues/8911
Loading