Browse files

add metriks reporting to logger

  • Loading branch information...
1 parent d95b10e commit 6b254193622630ac82b0a278b2b82797452edb01 @mislav committed Mar 11, 2013
Showing with 19 additions and 0 deletions.
  1. +1 −0 Gemfile
  2. +10 −0 Gemfile.lock
  3. +7 −0 app.rb
  4. +1 −0 config.yml
View
1 Gemfile
@@ -22,3 +22,4 @@ gem 'choices'
gem 'rake'
gem 'never-forget'
gem 'dalli'
+gem 'metriks-middleware'
View
10 Gemfile.lock
@@ -6,6 +6,8 @@ GEM
builder (~> 2.1.2)
i18n (~> 0.4)
activesupport (3.0.5)
+ atomic (1.0.1)
+ avl_tree (1.1.3)
bson (1.6.2)
bson_ext (1.6.2)
bson (~> 1.6.2)
@@ -24,7 +26,14 @@ GEM
faraday (>= 0.7.4, < 0.9)
haml (3.0.25)
hashie (1.1.0)
+ hitimes (1.2.0)
i18n (0.5.0)
+ metriks (0.9.9.4)
+ atomic (~> 1.0)
+ avl_tree (~> 1.1.2)
+ hitimes (~> 1.1)
+ metriks-middleware (2.0.0)
+ metriks (~> 0.9.9)
mingo (0.4.3)
mongo (>= 1.3)
mongo (1.6.2)
@@ -67,6 +76,7 @@ DEPENDENCIES
faraday_middleware
haml
i18n
+ metriks-middleware
mingo
mongo_ext
never-forget
View
7 app.rb
@@ -19,6 +19,8 @@
require_relative 'models'
require 'choices'
require 'json'
+require 'metriks/middleware'
+require 'metriks/reporter/logger'
Choices.load_settings(File.join(settings.root, 'config.yml'), settings.environment.to_s).each do |key, value|
set key.to_sym, value
@@ -109,6 +111,11 @@ def record(name)
# $stderr.puts "Cache hit: %s" % payload[:key]
end
end
+
+ if settings.metriks_interval
+ Metriks::Reporter::Logger.new(logger: Logger.new($stdout), interval: settings.metriks_interval).start
+ use Metriks::Middleware
+ end
end
helpers do
View
1 config.yml
@@ -1,5 +1,6 @@
default: &defaults
asset_host: <%= ENV['ASSET_HOST'] %>
+ metriks_interval: <%= ENV['METRIKS_INTERVAL'] %>
instagram:
client_id: <%= ENV['INSTAGRAM_CLIENT_ID'] %>
client_secret: <%= ENV['INSTAGRAM_SECRET'] %>

0 comments on commit 6b25419

Please sign in to comment.