Ruby on rails 带混合面板的新文物
当我的网站只受到登录pwd门的保护时,Mixpanel没有在Live View上显示New relic Ping,但我知道它正在Ping,就像我的网站关闭时显示的那样。现在出于某种原因,因为我们删除了“门”,这意味着网站是公开的,new relic每隔20秒就会在Mixpanel Live View上显示一次ping。这太可怕了。new relic和mixpanel都已与Ruby集成 你知道这是什么原因吗 谢谢Ruby on rails 带混合面板的新文物,ruby-on-rails,newrelic,mixpanel,Ruby On Rails,Newrelic,Mixpanel,当我的网站只受到登录pwd门的保护时,Mixpanel没有在Live View上显示New relic Ping,但我知道它正在Ping,就像我的网站关闭时显示的那样。现在出于某种原因,因为我们删除了“门”,这意味着网站是公开的,new relic每隔20秒就会在Mixpanel Live View上显示一次ping。这太可怕了。new relic和mixpanel都已与Ruby集成 你知道这是什么原因吗 谢谢 class ApplicationController < ActionCon
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
class ApplicationController[:destroy]
包括SimpleCaptcha::ControllerHelpers
def检查测试用户
#如果Rails.env==“development”,则返回
返回true,除非Rails.env.production?
会话[:beta]=如果request.referer&&request.referer==”则为truehttp://signup.mawwell.com/"
返回重定向到“http://xxxxxx.com/“除非会议[:beta]
结束
def get_跟踪器
@tracker=Mixpanel::tracker.new(Mixpanel\u CONFIG[:key])
如果当前用户
@user\u tracker\u id=当前用户.email
其他的
如果!会话[:匿名\u uid]
会话[:匿名\u uid]=SecureRandom.uuid
结束
@user\u tracker\u id=会话[:匿名\u uid]
结束
结束
def验证账户是否存在
如果I18n.locale==:ar
I18n.locale=:ar
cookies['googtrans']=“”
cookies['googtrans']=“/ar”
elsif I18n.locale==:en
I18n.locale=:en
cookies['googtrans']=“”
cookies['googtrans']=“/en”
结束
如果有人在场?参数['action']==“更改语言”和参数['controller']==“用户”
如果I18n.locale==:ar
I18n.locale=:en
cookies['googtrans']=“”
cookies['googtrans']=“/en”
elsif I18n.locale==:en
I18n.locale=:ar
cookies['googtrans']=“”
cookies['googtrans']=“/ar”
结束
结束
如果用户已登录?&&!当前用户是否处于活动状态?
注销(当前用户)
返回重定向到新用户会话路径:alert=>“您的帐户已停用”
结束
结束
从CanCan解救|u::拒绝访问do |异常|
将\重定向到根\ url,:alert=>exception.message
结束
结束
由于New Relic pinger发送一个标准GET或HEAD请求,并且仅在响应URL返回200时才报告,因此了解您是否在其他外部GET或HEAD请求中看到相同的行为将非常有趣。Mixplanel是否在监视命中密码网关的外部GET或HEAD请求?如果没有,这可以解释为什么你现在看到ping。您可能需要使用Mixpanel进行检查,以调查为什么在删除密码门后开始出现pinger通知
我找到了一个解决方案,基本上在Mixpanel跟踪器中,我添加了一个小代码,在登录页上说忽略new relic Ping