Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Easily monitor your product data

Easily monitor your product data

Damien Mathieu

June 18, 2014
Tweet

More Decks by Damien Mathieu

Other Decks in Technology

Transcript

  1. Product monitoring X new users this month.! X active users

    this month.! X users who left this month.! …
  2. module Api module V1 class StatsController < ::Api::V1::BaseController respond_to :json

    ! def index stats = StatService.search(current_user, params[:ids], params[:query]) respond_with stats, root: :stats end ! def show service = StatService.find(current_user, params[:id]) respond_with service.subject end ! def create service = StatService.new(Stat.new) service.save(permitted_params, current_user) ! respond_with service.subject end ! def update service = StatService.find(current_user, params[:id]) service.save(permitted_params, current_user) ! respond_with service.subject end ! def destroy service = StatService.find(current_user, params[:id]) service.destroy(current_user) ! respond_with service.subject end ! private def permitted_params params.require(:stat).permit(*StatService.permitted_params) end end end end
  3. What’s the easiest way to view data? SELECT date_trunc('month', users.created_at)

    as date, count(*) FROM users GROUP BY date ORDER BY date DESC;
  4. Are we done? Sure we’re not! What’s the way best

    to get an overall view of things?