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

Analytics for the busy Ruby developer

Analytics for the busy Ruby developer

Presentation given at Rubyconf Taiwan on Analytics for your Ruby application. http://www.polyglotprogramminginc.com

Lance Gleason

April 27, 2014
Tweet

More Decks by Lance Gleason

Other Decks in Technology

Transcript

  1. CREATE EXTERNAL TABLE events_1 ( id bigint, received_at string, generated_at

    string, source_id bigint, source_name string, source_ip string, facility string, severity string, program string, message string ) PARTITIONED BY ( dt string ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE LOCATION 's3://mybucket/papertrail/logs/production'; Sunday, April 27, 14
  2. CREATE EXTERNAL TABLE promotions_1 (id string, received_at string, source_id string,

    source_ip string, source_name string,measure string, instance string, promotion_id string, company_id string, controller string, action string) stored by 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHan dler' TBLPROPERTIES ("dynamodb.table.name" = "sh_promotions_latest", "dynamodb.column.mapping" = "id:id,received_at:received_at,source_id:source_id,source_i p:source_ip,source_name:source_name,measure:measure,i nstance:instance,promotion_id:promotion_id,company_id:c ompany_id,controller:controller,action:action"); Sunday, April 27, 14
  3. insert overwrite table promotions_1 select id, received_at, source_id, source_ip, source_name,

    get_json_object(message, '$.measure') as measure, get_json_object(message, '$.instance') as instance, get_json_object(message, '$.promotion_id') as promotion_id, get_json_object(message, '$.company_id') as company_id, get_json_object(message, '$.controller') as controller, get_json_object(message, '$.action') as action from events_1 where message like '%"promotion"%' ; Sunday, April 27, 14
  4. Nearly ALL sick people have eaten Rice (obviously then, the

    effects are cumulative). Sunday, April 27, 14
  5. An estimated 99.9% of all people who die from cancer

    or heart attacks have eaten Rice. Sunday, April 27, 14
  6. Another 99.9% of people involved in auto accidents ate Rice

    within 60-days before the accident. Sunday, April 27, 14
  7. Among people born in 1839 who later dined on Rice,

    there has been a 100% mortality rate Sunday, April 27, 14
  8. My shopping app just saw a spike in weekly usage

    after I made UI changes. Sunday, April 27, 14
  9. require 'rubygems' require 'rubyvis' vis = Rubyvis::Panel.new do width 150

    height 150 bar do data [1, 1.2, 1.7, 1.5, 0.7, 0.3] width 20 height {|d| d * 80} bottom(0) left {index * 25} end end vis.render() puts vis.to_svg # Output final SVG Sunday, April 27, 14
  10. <svg fill="none" font-family="sans-serif" font-size="10px" height="150.0" stroke="none" stroke-width="1.5" width="150.0"> <g transform="translate(0.0,0.0)">

    <rect fill="rgb(31,119,180)" height="80" width="20" y="70"/> <rect fill="rgb(31,119,180)" height="96.0" width="20" x="25" y="54.0"/> <rect fill="rgb(31,119,180)" height="136.0" width="20" x="50" y="14.0"/> <rect fill="rgb(31,119,180)" height="120.0" width="20" x="75" y="30.0"/> <rect fill="rgb(31,119,180)" height="56.0" width="20" x="100" y="94.0"/> <rect fill="rgb(31,119,180)" height="24.0" width="20" x="125" y="126.0"/> </g> </svg> Sunday, April 27, 14
  11. •Internet Explorer 9 and 10+ •Chrome 24, 25, and 26+

    •Safari 5 and 6+ •Firefox 19, 20, and 21+ Sunday, April 27, 14