Remove newrelic

This commit is contained in:
Wedge 2016-06-11 19:03:15 +03:00
parent 198def949b
commit af88b09d9e
6 changed files with 57 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*~ *~
1.sh
.bundle .bundle
.rvmrc .rvmrc
.DS_Store .DS_Store

View File

@ -20,7 +20,7 @@ gem 'russian'
gem 'state_machines-activerecord' gem 'state_machines-activerecord'
gem 'redis-rails' gem 'redis-rails'
gem 'newrelic_rpm' #gem 'newrelic_rpm'
gem 'jbuilder' gem 'jbuilder'
gem 'sprockets' gem 'sprockets'

View File

@ -242,7 +242,6 @@ GEM
nest (1.1.2) nest (1.1.2)
redis redis
netrc (0.11.0) netrc (0.11.0)
newrelic_rpm (3.15.2.317)
ng-rails-csrf (0.1.0) ng-rails-csrf (0.1.0)
ngannotate-rails (1.2.2) ngannotate-rails (1.2.2)
execjs execjs
@ -563,7 +562,6 @@ DEPENDENCIES
meta-tags meta-tags
meta_request meta_request
mock_redis mock_redis
newrelic_rpm
ng-rails-csrf ng-rails-csrf
ngannotate-rails ngannotate-rails
octokit (~> 4.0) octokit (~> 4.0)

View File

@ -1,6 +1,8 @@
class CleanApiDefenderStatisticsJob class CleanApiDefenderStatisticsJob
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options :queue => :low
def perform def perform
deadline = Date.today - 1.month deadline = Date.today - 1.month
Redis.current.keys.select do |key| Redis.current.keys.select do |key|

View File

@ -1,6 +1,8 @@
class CleanRpmBuildNodeJob class CleanRpmBuildNodeJob
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options :queue => :low
def perform def perform
RpmBuildNode.all.each do |n| RpmBuildNode.all.each do |n|
n.delete unless n.user_id n.delete unless n.user_id

View File

@ -10,3 +10,54 @@ Sidekiq.configure_server do |config|
end end
end end
if ENV["PROFILE"]
require "objspace"
ObjectSpace.trace_object_allocations_start
Sidekiq.logger.info "allocations tracing enabled"
module Sidekiq
module Middleware
module Server
class Profiler
# Number of jobs to process before reporting
JOBS = 100
class << self
mattr_accessor :counter
self.counter = 0
def synchronize(&block)
@lock ||= Mutex.new
@lock.synchronize(&block)
end
end
def call(worker_instance, item, queue)
begin
yield
ensure
self.class.synchronize do
self.class.counter += 1
if self.class.counter % JOBS == 0
Sidekiq.logger.info "reporting allocations after #{self.class.counter} jobs"
GC.start
out = File.open("/tmp/heap.json", "w")
ObjectSpace.dump_all(output: out)
out.close
Sidekiq.logger.info "heap saved to heap.json"
end
end
end
end
end
end
end
end
Sidekiq.configure_server do |config|
config.server_middleware do |chain|
chain.add Sidekiq::Middleware::Server::Profiler
end
end
end