Skip to content
This repository
Browse code

add metriks reporting to logger

  • Loading branch information...
commit 6b254193622630ac82b0a278b2b82797452edb01 1 parent d95b10e
Mislav Marohnić authored

Showing 4 changed files with 19 additions and 0 deletions. Show diff stats Hide diff stats

  1. +1 0  Gemfile
  2. +10 0 Gemfile.lock
  3. +7 0 app.rb
  4. +1 0  config.yml
1  Gemfile
@@ -22,3 +22,4 @@ gem 'choices'
22 22 gem 'rake'
23 23 gem 'never-forget'
24 24 gem 'dalli'
  25 +gem 'metriks-middleware'
10 Gemfile.lock
@@ -6,6 +6,8 @@ GEM
6 6 builder (~> 2.1.2)
7 7 i18n (~> 0.4)
8 8 activesupport (3.0.5)
  9 + atomic (1.0.1)
  10 + avl_tree (1.1.3)
9 11 bson (1.6.2)
10 12 bson_ext (1.6.2)
11 13 bson (~> 1.6.2)
@@ -24,7 +26,14 @@ GEM
24 26 faraday (>= 0.7.4, < 0.9)
25 27 haml (3.0.25)
26 28 hashie (1.1.0)
  29 + hitimes (1.2.0)
27 30 i18n (0.5.0)
  31 + metriks (0.9.9.4)
  32 + atomic (~> 1.0)
  33 + avl_tree (~> 1.1.2)
  34 + hitimes (~> 1.1)
  35 + metriks-middleware (2.0.0)
  36 + metriks (~> 0.9.9)
28 37 mingo (0.4.3)
29 38 mongo (>= 1.3)
30 39 mongo (1.6.2)
@@ -67,6 +76,7 @@ DEPENDENCIES
67 76 faraday_middleware
68 77 haml
69 78 i18n
  79 + metriks-middleware
70 80 mingo
71 81 mongo_ext
72 82 never-forget
7 app.rb
@@ -19,6 +19,8 @@
19 19 require_relative 'models'
20 20 require 'choices'
21 21 require 'json'
  22 +require 'metriks/middleware'
  23 +require 'metriks/reporter/logger'
22 24
23 25 Choices.load_settings(File.join(settings.root, 'config.yml'), settings.environment.to_s).each do |key, value|
24 26 set key.to_sym, value
@@ -109,6 +111,11 @@ def record(name)
109 111 # $stderr.puts "Cache hit: %s" % payload[:key]
110 112 end
111 113 end
  114 +
  115 + if settings.metriks_interval
  116 + Metriks::Reporter::Logger.new(logger: Logger.new($stdout), interval: settings.metriks_interval).start
  117 + use Metriks::Middleware
  118 + end
112 119 end
113 120
114 121 helpers do
1  config.yml
... ... @@ -1,5 +1,6 @@
1 1 default: &defaults
2 2 asset_host: <%= ENV['ASSET_HOST'] %>
  3 + metriks_interval: <%= ENV['METRIKS_INTERVAL'] %>
3 4 instagram:
4 5 client_id: <%= ENV['INSTAGRAM_CLIENT_ID'] %>
5 6 client_secret: <%= ENV['INSTAGRAM_SECRET'] %>

0 comments on commit 6b25419

Please sign in to comment.
Something went wrong with that request. Please try again.