In my previous post, I detailed how we automated the process of communicating what code was deployed while also improving transparency by sending out Daily Deploy Notes after each deploy to production. Now, I’ll detail a similar feature that further improves upon the visibilty that everyone in the company has to application improvements and even key business statistics.
Summarizing production code changes on a daily basis is very useful and almost essential when practicing continuous deployment. But it can be a bit too granular when trying to get a higher level view of what was deployed over a certain time period. We decided it would be useful to have a summary of what was deployed on a weekly basis; and thus, the This week in Fundbase (TWIF) weekly email was born. It would start as a tool to summarize deployed code, but evolve to include any important data points we deem useful.
In it’s first iteration, the TWIF email summarized deployed code in the same format as the Daily Deploy Notes:
How it works is we query the Githup API to return all closed PRs to master:
# @returns the last 30 PRs. # Ordered by created_at desc. def merged_pulls url = 'https://api.github.com/repos/Fundbase/fundbase/pulls?'\ 'state=closed&base=master' resp = Net::HTTP.get_response(URI.parse(url)) JSON.parse(resp.body) end
We then iterate PRs to retrieve all that were deployed within the week:
def merged_pulls_this_week merged_pulls.each_with_object() do |task, arr| merged_at = Date.parse(task['merged_at']) if merged_at >= 1.week.ago arr << task else # Because it's ordered, no need to keep checking once # we find the first PR that is older than a week. return arr end end end
From here, we need to parse the descriptions bodies and group the tasks by type. Lucky for us, we already have this functionality from the Daily Deploy Notes so we can reuse our GithubPrParser module:
def parse_deployed_tasks github_parser = GithubPrParser.new # Iterate and group tasks by type ...
This is triggered by a cron job that runs every Sunday night.
Since this intial implementation, we have also included Mixpanel metrics such as Logins and Events via its API. I’ll detail this further in a future post. On the roadmap we plan to include data from other key external tools such as:
But it doesn’t stop there, we can even include interal reporting tools such as:
- Weekly On-boarding (funds we bring into Fundbase each day)
- Weekly Sales & Support stats
All companies have metrics that they review on a weekly basis to gauge the health of the business from a high level and specific areas. This is absolutely critical as it empowers proactive decision making by revealing trends. But often times this data is reported manually, as our daily deploys were and much of our metrics continue to be. Yet this type of reporting is an obvious opportunity for automation and can result in enormous time savings for key resources (people) over the course of a year. Not to mention a fun development exercise.