2016-11-04 15 views
0

我New Relic的見解是從登錄本地機器中開發環境的瀏覽量和用戶代理信息。我在另一個城市有另一個開發人員,他們也正在開發環境瀏覽量和其他信息被記錄。New Relic的見解在開發環境記錄瀏覽量和用戶代理信息從本地機器

當我拉起樣品,我看到本地主機:3000,這是我的口。

但是,生產信息也被記錄。

我使用Heroku的默認設置New Relic的運行。它會自動將許可證密鑰設置爲環境變量。我沒有許可證密鑰在應用程序的任何地方,它只通過一個環境變量設置。

如果我拉起我的本地開發環境,導航到端口3000並刷新,然後在最後一分鐘查詢New Relic Insights中的事件,我會看到我的城市,我的用戶代理信息,我訪問的網址和綜合瀏覽量。我們的產品處於測試階段,我的位置上的實際用戶確實沒有機會碰到同一個隨機頁面。

我已經嘗試關閉開發模式,顯示器關閉。我無法理解這是怎麼發生的。

我有託管於AWS(圖像和一些JS)一些文件,如果該事項

的Gemfile

group :production do 
    gem 'rails_12factor' 
    gem 'newrelic_rpm' 
end 

配置/ newrelic.yml

common: &default_settings 
    license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %> 

    log_level: info 

development: 
    <<: *default_settings 
    app_name: app-dev 
    developer_mode: false 
    monitor_mode: false 
    agent_enabled: false 
test: 
    <<: *default_settings 
    monitor_mode: false 
    developer_mode: false 
    agent_enabled: false 

production: 
    app_name: app-prod 
    monitor_mode: true 
    agent_enabled: false 

    <<: *default_settings 

配置/美洲獅。 rb

require 'puma_worker_killer' 
    ActiveRecord::Base.connection_pool.disconnect! 

    PumaWorkerKiller.config do |config| 
    config.ram   = ENV['PUMA_WORKER_KILLER_RAM'] || 1024 # mb 
    config.frequency  = 5 # seconds 
    config.percent_usage = 0.98 
    config.rolling_restart_frequency = 12 * 3600 # 12 hours in seconds 
    end 

    PumaWorkerKiller.start 
end 

workers Integer(ENV['WEB_CONCURRENCY'] || 5) 

min_threads_count = Integer(ENV['MIN_THREADS'] || 1) 

threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5) 

threads min_threads_count, threads_count 

preload_app! 

rackup  DefaultRackup 
port  ENV['PORT']  || 3000 
environment ENV['RACK_ENV'] || 'development' 

on_worker_boot do 
    # Worker specific setup for Rails 4.1+ 
    # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot 
    # @sidekiq_pid ||= spawn('bundle exec sidekiq -c 2 -q default -q mailers') 


    ActiveSupport.on_load(:active_record) do 
    ActiveRecord::Base.establish_connection 
    end 
end 

配置/初始化/ sidekiq.rb

require 'sidekiq' 
redis_url = ENV['REDISTOGO_URL'] 

redis_config = { 
    url: redis_url, 
    namespace: 'oct', 
} 

Sidekiq.configure_server do |config| 
    config.redis = { 
    url: ENV["REDISTOGO_URL"], namespace: 'app', 
    size: ENV["SIDEKIQ_SERVER_CONNECTIONS"].to_i || 6 
    } 

    config.error_handlers << Proc.new do |exception, context_hash| 
    SidekiqErrorService.new(exception, context_hash).notify 
    end 
end 

Sidekiq.configure_client do |config| 
    config.redis = { 
    url: ENV["REDISTOGO_URL"], namespace: 'app', 
    size: ENV["REDIS_CLIENT_CONNECTION_SIZE"].to_i || 2 
    } 
end 

回答

0

所以我相信這是New Relic的瀏覽器JS,我包括在我的網頁的頭部。一旦我設置 - 如果production_environment? (我的幫手方法),那麼我只看到了生產環境的流量。

我相信那個JS裏的東西正在刺探我的New Relic。

現在已經修復。

相關問題