Skip to content

Commit

Permalink
Show adoption rate chart for historical releases
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Nov 16, 2023
1 parent bf5eb90 commit cca5866
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/components/release_monitoring_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ def session_stability
end

def adoption_chart_data
return unless release_data
range_end = release_data.fetched_at
range_start = deployment_run.created_at
@chart_data ||= deployment_run
.release_health_metrics
.group_by_day(:fetched_at, last: 10)
.group_by_day(:fetched_at, range: range_start..range_end)
.maximum("round(CAST(sessions_in_last_day::float * 100 / total_sessions_in_last_day::float as numeric), 2)")
.compact
.map { |k, v| [k.strftime("%d %b"), {adoption_rate: v, rollout_percentage: deployment_run.rollout_percentage_at(k)}] }
.last(10)
.to_h

return unless @chart_data.keys.size >= 2
Expand Down

0 comments on commit cca5866

Please sign in to comment.