Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mutle/fu2
base: 4925f3c37b
...
head fork: mutle/fu2
compare: 406f7e2d52
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
1  Gemfile
@@ -13,6 +13,7 @@ gem "redis"
gem "html-pipeline", :require => "html/pipeline"
gem "tire"
gem 'newrelic_rpm'
+gem 'statsd-ruby', :require => "statsd"
# Gems used only for assets and not required
# in production environments by default.
View
2  Gemfile.lock
@@ -140,6 +140,7 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ statsd-ruby (1.1.0)
thor (0.16.0)
tilt (1.3.3)
tire (0.5.1)
@@ -177,6 +178,7 @@ DEPENDENCIES
rspec
rspec-rails
sass-rails (~> 3.2.4)
+ statsd-ruby
tire
uglifier
will_paginate
View
4 app/controllers/application_controller.rb
@@ -35,6 +35,10 @@ def notification(type, object)
$redis.publish 'fu2_live', {:type => type, :object => object.as_json}.to_json
end
+ def increment_metric(name)
+ METRICS.increment name
+ end
+
def highlight_results(text, query)
query.split(" ").inject(text) { |s,q| s = highlight(s, q) }
end
View
5 app/controllers/channels_controller.rb
@@ -51,6 +51,11 @@ def new
def create
@channel = Channel.create(params[:channel].merge(:user_id => current_user.id, :markdown => current_user.markdown?))
notification :channel_create, @channel
+ increment_metric "posts"
+ increment_metric "posts.user.#{current_user.id}"
+ increment_metric "channels"
+ increment_metric "channels.id.#{@channel.id}.posts"
+ increment_metric "channels.user.#{current_user.id}"
respond_with @channel do |f|
f.html { redirect_to channel_path(@channel) }
View
3  app/controllers/posts_controller.rb
@@ -8,6 +8,9 @@ class PostsController < ApplicationController
def create
@post = @channel.posts.create(:body => params[:post][:body], :user_id => current_user.id, :markdown => current_user.markdown?)
notification :post_create, @post
+ increment_metric "posts"
+ increment_metric "channels.id.#{@channel.id}.posts"
+ increment_metric "posts.user.#{current_user.id}"
respond_with @post do |f|
f.html { redirect_to channel_path(@channel, :anchor => "post_#{@post.id}") }
View
2  app/models/post.rb
@@ -42,7 +42,7 @@ def delete_channel_visits
end
def update_channel_last_post
- channel.update_attribute(:last_post, created_at)
+ channel.update_attribute(:last_post, created_at) if channel
end
def set_markdown
View
2  config/initializers/statsd.rb
@@ -0,0 +1,2 @@
+METRICS = Statsd.new(ENV['UTIL_MONITOR_IP'] || 'localhost', 8125)
+METRICS.namespace = "fu2"

No commit comments for this range

Something went wrong with that request. Please try again.