Skip to content

Commit

Permalink
UPDATES
Browse files Browse the repository at this point in the history
  • Loading branch information
webdestroya committed Sep 13, 2015
1 parent e1aee9b commit 74d734f
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 425 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -23,4 +23,6 @@
/.DS_Store
/doc/gh_sparkline.js
/tempodb.csv
/lib/tasks/tempo.rake
/lib/tasks/tempo.rake
/heroku_dumps
heroku_sync.sh
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
1.9.3-p551
14 changes: 9 additions & 5 deletions Gemfile
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

ruby "1.9.3"

gem 'rails', '3.2.19'
gem 'rails', '~> 3.2.19'
gem 'rack', '~> 1.4.5'
gem 'json', '>= 1.7.7'

Expand Down Expand Up @@ -40,6 +40,8 @@ end
gem 'jquery-rails'

gem "rspec-rails", :group => [:test, :development]
gem 'dotenv-rails', '~> 0.11', :group => [:test, :development]

group :test do
gem "factory_girl_rails"
gem "guard-rspec"
Expand Down Expand Up @@ -110,7 +112,7 @@ end
gem 'rubyzip', :require => ["zip/zip"]

# Performance metrics
gem "newrelic_rpm", "~> 3.5.5.540.dev", :group => :production
# gem "newrelic_rpm", "~> 3.5.5.540.dev", :group => :production

# Pretty form display
gem 'simple_form'
Expand All @@ -121,8 +123,10 @@ gem 'psych'
# jQuery file uploader assets
gem "jquery-fileupload-rails"

# Time series service
gem 'tempodb'

# Elastic Search
# gem 'tire'

# Metrics
gem "skylight"

gem 'rollbar', '~> 2.2.1'
20 changes: 12 additions & 8 deletions Gemfile.lock
Expand Up @@ -65,6 +65,11 @@ GEM
execjs
coffee-script-source (1.4.0)
diff-lcs (1.1.3)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
dotenv-rails (0.11.1)
dotenv (= 0.11.1)
erubis (2.7.0)
excon (0.16.10)
execjs (1.4.0)
Expand Down Expand Up @@ -106,7 +111,6 @@ GEM
hashie (1.2.0)
hike (1.2.3)
httpauth (0.2.0)
httpclient (2.3.3)
i18n (0.6.11)
jeweler (1.8.4)
bundler (~> 1.0)
Expand Down Expand Up @@ -146,7 +150,6 @@ GEM
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-ssh (2.6.3)
newrelic_rpm (3.5.5.540.dev)
nokogiri (1.5.6)
oauth2 (0.8.0)
faraday (~> 0.8)
Expand Down Expand Up @@ -225,6 +228,7 @@ GEM
redis (>= 2.2.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rollbar (2.2.1)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
Expand Down Expand Up @@ -256,6 +260,8 @@ GEM
simple_form (2.0.4)
actionpack (~> 3.0)
activemodel (~> 3.0)
skylight (0.8.0)
activesupport (>= 3.0.0)
slop (3.3.3)
sprockets (2.2.2)
hike (~> 1.2)
Expand All @@ -270,9 +276,6 @@ GEM
actionpack (~> 3.0)
activemodel (~> 3.0)
railties (~> 3.0)
tempodb (0.5.4)
httpclient
json
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.15)
Expand Down Expand Up @@ -302,6 +305,7 @@ DEPENDENCIES
cancan
capybara (= 1.1.2)
coffee-rails (~> 3.2.1)
dotenv-rails (~> 0.11)
factory_girl
factory_girl_rails
font-awesome-rails
Expand All @@ -314,28 +318,28 @@ DEPENDENCIES
kaminari
localeapp
morris-rails!
newrelic_rpm (~> 3.5.5.540.dev)
omniauth
omniauth-allied_modders
omniauth-openid
omniauth-steam
pg
psych
rack (~> 1.4.5)
rails (= 3.2.19)
rails (~> 3.2.19)
raphaeljs-rails
redis
redis-rails
rollbar (~> 2.2.1)
rspec (= 2.8.0)
rspec-rails
rubyzip
sass-rails (~> 3.2.3)
select2-rails
selenium-webdriver (= 2.20.0)
simple_form
skylight
steam-condenser
strong_parameters
tempodb
turn (= 0.8.2)
uglifier (>= 1.0.3)
unicorn
57 changes: 0 additions & 57 deletions app/assets/javascripts/metrics.js.coffee

This file was deleted.

10 changes: 0 additions & 10 deletions app/assets/javascripts/metrics_graphing.js

This file was deleted.

72 changes: 0 additions & 72 deletions app/controllers/metrics_controller.rb
Expand Up @@ -3,67 +3,6 @@ class MetricsController < ApplicationController
def index
end

def translations

metrics = {}
resp = {
metrics: []
}

readkey("translations").each do |point|
time = format_time point.ts
metrics[time] = {t: point.value}
end

readkey("translations_web").each do |point|
metrics[format_time(point.ts)].merge!({w: point.value})
end

# readkey("translations_imported").each do |point|
# metrics[format_time(point.ts)].merge!({i: point.value})
# end

metrics.each_pair do |k,v|
resp[:metrics] << v.merge({d: k})
end

render :json => resp
end


def plugins
resp = {
metrics: []
}
readkey("plugins").each do |point|
resp[:metrics] << {
d: format_time(point.ts),
p: point.value
}
end
render :json => resp
end

def users
resp = {
metrics: [],
providers: []
}
readkey("users").each do |point|
resp[:metrics] << {
d: format_time(point.ts),
u: point.value
}
end

User.group(:provider).count.each do |provider,num|
resp[:providers] << {label: provider_name(provider), value: num}
end

render :json => resp
end


# This should be called in order to log the metrics to tempodb
# ?nosave=1 to not save to tempodb
# TODO: Maybe some cheesy authentication? param checking?
Expand Down Expand Up @@ -103,12 +42,9 @@ def update
metrics << {key: "tags_used", v: Tag.used.count}
metrics << {key: "tags_unused", v: Tag.unused.count}

tempodb.write_bulk timestamp, metrics unless params[:nosave].eql?("1")

response = {
timestamp: timestamp,
metric_count: metrics.size,
nosave: params[:nosave].eql?("1"),
metrics: metrics,
}

Expand All @@ -117,19 +53,11 @@ def update

private

def readkey(key)
tempodb.read_key(key, 1.year.ago, Time.now.utc, :interval => "1day").data
end

def format_time(ts)
# ts.strftime "%Y-%m-%d %H:00"
ts.strftime "%Y-%m-%d"
end

def tempodb
@tempodb ||= TempoDB::Client.new(ENV['TEMPODB_API_KEY'], ENV['TEMPODB_API_SECRET'])
end

def provider_name(provider)
return "AlliedModders" if provider.eql?("allied_modders")
return "Steam" if provider.eql?("steam")
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sourcemod_plugins_controller.rb
Expand Up @@ -20,7 +20,7 @@ def index

@sourcemod_plugin.name = params[:name] || ''

search = SourcemodPlugin.includes(:user)
search = SourcemodPlugin.includes(:user, :tags)


if !@sourcemod_plugin.name.blank?
Expand Down
2 changes: 1 addition & 1 deletion app/views/metrics/index.html.erb
Expand Up @@ -12,7 +12,7 @@



<div class="row">
<div class="row metrics-graph-divs">
<div class="span7">
<h3>Users</h3>
<div id="users_chart" style="width:600px;height:300px;"></div>
Expand Down
8 changes: 8 additions & 0 deletions app/views/pages/changelog.html.erb
Expand Up @@ -5,6 +5,14 @@

<p>I will try to keep this updated with changes I make in each version.</p>

<h3>0.5.1 - (2015-09-12)</h3>
<ul>
<li>Added instrumentation to the app to monitor API calls</li>
<li>Removed time-series endpoints</li>
<li>Added exception tracking service</li>
<li>Improved database</li>
</ul>


<h3>0.5.0 - (2013-03-30)</h3>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions app/views/sourcemod_plugins/_sourcemod_plugin.html.erb
Expand Up @@ -16,10 +16,10 @@
</p>


<% if sourcemod_plugin.tags.count > 0 %>
<% if sourcemod_plugin.tags.size > 0 %>
<strong>Tags:</strong>
<ul class="taglist">
<% sourcemod_plugin.tags.order("tags.name ASC").each do |tag| %>
<% sourcemod_plugin.tags.sort{|a,b| a.name <=> b.name}.each do |tag| %>
<li><%= link_to tag.name, tagged_sourcemod_plugins_path(tag.name) %></li>
<% end %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion config/database.yml
Expand Up @@ -7,7 +7,7 @@ development:
adapter: postgresql
username: rails
password: rails99
database: sourcemod_translator_development
database: sourcemod_translator
pool: 5

# Warning: The database defined as "test" will be erased and
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -27,7 +27,7 @@

# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
config.active_record.auto_explain_threshold_in_seconds = 1.0

# Do not compress assets
config.assets.compress = false
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Expand Up @@ -43,7 +43,7 @@
# config.cache_store = :mem_cache_store

# Enable serving of images, stylesheets, and JavaScripts from an asset server
config.action_controller.asset_host = "//#{ENV['ASSET_DIRECTORY']}.s3.amazonaws.com"
config.action_controller.asset_host = "//#{ENV['ASSET_HOST']}"

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( bootstrap.js bootstrap.css jquery-fileupload.js uploads.js metrics_graphing.js metrics_graphing.css plugin_stats.js )
Expand Down

0 comments on commit 74d734f

Please sign in to comment.