带有Mixpanel的New Relic

时间:2014-04-09 05:06:14

标签: ruby-on-rails newrelic mixpanel

当我的网站仅受登录pwd门保护时,Mixpanel没有在实时视图上显示新文件,但我知道它正在ping,因为它在我的网站关闭时显示。现在由于某种原因,由于我们删除了“门”,意味着该网站是公开的,所以在Mixpanel Live View上每20秒ping一次新的遗物。这很糟糕。新文物和混合面板都已与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

2 个答案:

答案 0 :(得分:0)

由于New Relic pinger发送标准GET或HEAD请求,并且只报告响应URL是否返回200,因此查看您是否看到与其他外部GET或HEAD请求相同的行为将会很有趣。 Mixplanel是否监控到达密码网关的外部GET或HEAD请求?如果没有,这可以解释为什么你现在看到ping。您可能需要查看Mixpanel以调查在删除密码门后开始出现pinger通知的原因。

https://discuss.newrelic.com/t/issue-new-relic-pings-showing-mixpanel/1089/2

答案 1 :(得分:0)

我找到了一个解决方案,基本上在Mixpanel跟踪器中,我添加了一个小代码,表示忽略着陆页上的新遗物