简体   繁体   English

Ruby on Rails 2.3.8-通过IP地址忽略Airbrake

[英]Ruby on Rails 2.3.8 - Airbrake Ignore by IP Address

I am using the Airbrake gem to report errors in my rails application. 我正在使用Airbrake gem报告我的rails应用程序中的错误。

Is it possible to not have reports sent if it has a certain IP address, I would like to ignore the following: 如果它具有某个IP地址,是否可以不发送报告,我想忽略以下内容:

213.233.458.* 213.233.458。*

I have looked at the docs and noticed a method called ignore_by_filters but wondering how I would employ this to ignore by IP address. 我看了看文档,发现一个名为ignore_by_filters的方法,但想知道如何使用此方法来忽略IP地址。

Does the exception_data variable hold information on the requesting IP or any other way to access it? exception_data变量是否包含有关请求IP或其他任何访问它的信息的信息?

You could just use: 您可以使用:

Airbrake.notify e unless request.remote_ip == "ip"

request.remote_ip can be accessed in the controller, so you could just pass this to the model if needed. 可以在控制器中访问request.remote_ip,因此您可以根据需要将其传递给模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM