当我的网站仅受登录密码门保护时,Mixpanel 没有在实时视图上显示 New relic ping,但我知道它正在 ping,因为它在我的网站关闭时显示。现在由于某种原因,由于我们删除了意味着网站是公开的“门”,因此每 20 秒新的文物 ping 就会显示在 Mixpanel 实时视图上。这很糟糕。new relic 和 mixpanel 都已与 Ruby 集成。
知道是什么原因造成的吗?
谢谢
class ApplicationController < ActionController::Base
http_basic_authenticate_with name: "xxxx", password: "xxx", if: Proc.new{ Rails.env.staging? }
# before_filter :check_beta_user
before_filter :get_tracker
before_filter :verify_account_existance, :except => [:destroy]
include SimpleCaptcha::ControllerHelpers
def check_beta_user
# return if Rails.env == "development"
return true unless Rails.env.production?
session[:beta] = true if request.referrer && request.referrer == "http://signup.mawwell.com/"
return redirect_to "http://xxxxxx.com/" unless session[:beta]
end
def get_tracker
@tracker = Mixpanel::Tracker.new(MIXPANEL_CONFIG[:key])
if current_user
@user_tracker_id = current_user.email
else
if !session[:anonymous_uid]
session[:anonymous_uid] = SecureRandom.uuid
end
@user_tracker_id = session[:anonymous_uid]
end
end
def verify_account_existance
if I18n.locale == :ar
I18n.locale = :ar
cookies['googtrans'] =""
cookies['googtrans']="/ar"
elsif I18n.locale == :en
I18n.locale = :en
cookies['googtrans'] = ""
cookies['googtrans']="/en"
end
if params.present? and params['action'] == "change_language" and params['controller'] == "users"
if I18n.locale == :ar
I18n.locale = :en
cookies['googtrans'] =""
cookies['googtrans']="/en"
elsif I18n.locale == :en
I18n.locale = :ar
cookies['googtrans'] = ""
cookies['googtrans']="/ar"
end
end
if user_signed_in? && !current_user.is_active?
sign_out(current_user)
return redirect_to new_user_session_path, :alert => "Your account has been deactivated"
end
end
rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, :alert => exception.message
end
end