Garelic: Google Analytics as App Performance monitoring
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Garelic: Google Analytics as App Performance monitoring

  • 2,486 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,486
On Slideshare
2,084
From Embeds
402
Number of Embeds
4

Actions

Shares
Downloads
18
Comments
0
Likes
1

Embeds 402

http://lanyrd.com 386
https://twitter.com 13
https://www.linkedin.com 2
http://www.linkedin.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Garelic: GoogleAnalytics as AppPerformanceMonitoring@jsuchal (@rubyslava #21)
  • 2. Features
  • 3. Controller:Average response times per action
  • 4. Controller:Most time spent per action
  • 5. Controller:Slowest pages
  • 6. Controller:Response times histogram
  • 7. Controller:Response times on timeline
  • 8. ActiveRecord:Average/most time spent per model
  • 9. Deployments:Average response times per deploy
  • 10. and much more...compare, segment,slice & dice
  • 11. Why?● NewRelic is really great...but ○ "Database call response times" ■ Standard package = $24/month/server ○ "Transaction tracing" ■ Pro package = $149/month/server ○ basically unavailable for freelancers and small projects● Proof-of-concept ○ 2 hours of hacking ○ 2 hours of waiting for Google Analytics
  • 12. How?● Google Analytics Site Speed User Timing _gaq.push([‘_trackTiming’, category, variable, time, opt_label, opt_sample]);● Google Analytics Custom Variables _gaq.push([`_setCustomVar’, index, name, value, opt_scope]);● ActiveSupport::Notifications ActiveSupport::Notifications.subscribe(process_action.action_controller) do |_, from, to, _, payload| Garelic::Metrics.report(:action, :db_runtime, payload[:db_runtime] || 0) Garelic::Metrics.report(:action, :view_runtime, payload[:view_runtime] || 0) Garelic::Metrics.report(:action, :total_runtime, (to - from) * 1000) Garelic::Metrics.action_identifier = "#{payload[:controller]}##{payload[:action]}" end ActiveSupport::Notifications.subscribe(sql.active_record) do |_, start, finish, _, payload| type = payload[:name] || Other SQL Garelic::Metrics.report(:active_record, type, (finish - start) * 1000) if type != CACHE end
  • 13. How?● Ruby Monkey Patching module ActionController class Metal < AbstractController::Base alias :dispatch_without_garelic :dispatch def dispatch(*args) Garelic::Metrics.reset! response = dispatch_without_garelic(*args) timing_data = Garelic.report_user_timing_from_metrics(Garelic::Metrics) _, _, chunks = response chunks.each do |chunk| chunk.gsub!(Garelic::Timing, timing_data) end response end end end
  • 14. Limitations● Cannot measure redirect, AJAX, async jobs● Everything is visible in source code ○ Reporting stacktrace & raw SQL considered harmful● Page caching breaks reports● Its a hack & GA has its own limitations
  • 15. Ideas for future development● Tracking errors via GA events on error 500 pages● Tracking only slow responses (thresholding)● Share Google Analytics dashboards & custom reports● Pull requests welcome! https://github. com/jsuchal/garelic
  • 16. Related resources● All Presentation Software is Broken http://www. igvita.com/2012/05/14/all-presentation-software-is-broken/● GA User Timing Method https://developers.google. com/analytics/devguides/collection/gajs/methods/gaJSApiUserTiming● GA Custom Variables https://developers.google. com/analytics/devguides/collection/gajs/gaTrackingCustomVariables#setu p