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

Garelic: Google Analytics as App Performance monitoring

on

  • 2,309 views

 

Statistics

Views

Total Views
2,309
Views on SlideShare
1,907
Embed Views
402

Actions

Likes
1
Downloads
17
Comments
0

4 Embeds 402

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

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Garelic: Google Analytics as App Performance monitoring Garelic: Google Analytics as App Performance monitoring Presentation Transcript

  • Garelic: GoogleAnalytics as AppPerformanceMonitoring@jsuchal (@rubyslava #21)
  • Features
  • Controller:Average response times per action
  • Controller:Most time spent per action
  • Controller:Slowest pages
  • Controller:Response times histogram
  • Controller:Response times on timeline
  • ActiveRecord:Average/most time spent per model
  • Deployments:Average response times per deploy
  • and much more...compare, segment,slice & dice
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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