2016-11-16 11:01:10 +00:00
|
|
|
module Gitlab
|
|
|
|
module CycleAnalytics
|
2016-11-17 12:22:27 +00:00
|
|
|
class StagingEvent < BaseEvent
|
2016-11-17 17:00:37 +00:00
|
|
|
def initialize(*args)
|
|
|
|
@start_time_attrs = mr_metrics_table[:merged_at]
|
|
|
|
@end_time_attrs = mr_metrics_table[:first_deployed_to_production_at]
|
|
|
|
@projections = [build_table[:id]]
|
|
|
|
@order = build_table[:created_at]
|
2016-11-16 11:01:10 +00:00
|
|
|
|
2016-11-17 17:00:37 +00:00
|
|
|
super(*args)
|
|
|
|
end
|
|
|
|
|
2016-11-18 11:05:29 +00:00
|
|
|
def fetch
|
2016-11-18 12:00:38 +00:00
|
|
|
Updater.update!(event_result, from: 'id', to: 'build', klass: ::Ci::Build)
|
2016-11-18 11:05:29 +00:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
2016-11-17 17:00:37 +00:00
|
|
|
def custom_query(base_query)
|
2016-11-16 11:01:10 +00:00
|
|
|
base_query.join(build_table).on(mr_metrics_table[:pipeline_id].eq(build_table[:commit_id]))
|
|
|
|
end
|
2016-11-17 12:22:27 +00:00
|
|
|
|
2016-11-17 17:00:37 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def serialize(event)
|
2016-11-18 11:05:29 +00:00
|
|
|
AnalyticsBuildSerializer.new.represent(event['build']).as_json
|
2016-11-17 12:22:27 +00:00
|
|
|
end
|
2016-11-16 11:01:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|