Permalink
Browse files

Collect import counts in StatHat

  • Loading branch information...
1 parent f5ba9f4 commit f9b7a8170c6f4011dba1df103d92590e2ba8d1e6 @rwdaigle committed May 26, 2012
Showing with 9 additions and 0 deletions.
  1. +7 −0 app/receivers/log_receiver.rb
  2. +2 −0 config/initializers/stat_hat.rb
@@ -17,13 +17,15 @@ def event_receivers
lambda { |action, log_data|
if(action == 'wod-import')
stat_hat_post_performance(StatHatConfig::EVENT_IMPORT_WOD_WORDNIK_PERFORMANCE, log_data)
+ stat_hat_post_increment(StatHatConfig::EVENT_IMPORT_WOD_WORDNIK_REQUEST)
end
},
# EVENT_IMPORT_EMAIL_PERFORMANCE
lambda { |action, log_data|
if(action == 'email-import')
stat_hat_post_performance(StatHatConfig::EVENT_IMPORT_EMAIL_PERFORMANCE, log_data)
+ stat_hat_post_increment(StatHatConfig::EVENT_IMPORT_EMAIL_REQUEST)
end
}
]
@@ -35,5 +37,10 @@ def stat_hat_post_performance(event, log_data)
StatHat::API.ez_post_value(event, ENV['STAT_HAT_KEY'], value)
end
end
+
+ def stat_hat_post_increment(event, increment = 1)
+ Scrolls.log({'action' => 'stathat-post-counter', 'event' => event, 'value' => increment})
+ StatHat::API.ez_post_count(event, ENV['STAT_HAT_KEY'], increment)
+ end
end
end
@@ -2,6 +2,8 @@ module StatHatConfig
# Imports
EVENT_IMPORT_WOD_WORDNIK_PERFORMANCE = 'Wordnik WoD Import Performance'
+ EVENT_IMPORT_WOD_WORDNIK_REQUEST = 'Wordnik WoD Import Requests'
EVENT_IMPORT_EMAIL_PERFORMANCE = 'Email Import Performance'
+ EVENT_IMPORT_EMAIL_REQUEST = 'Email Import Requests'
end

0 comments on commit f9b7a81

Please sign in to comment.