2012-04-26 23 views
3

我使用红宝石NewRelic的试剂和它被插入一些js代码从我的应用程序每个HMTL响应,例如,在头部中:var NREUMQ = []; NREUMQ.push( [“mark”,“firstbyte”,new Date()。getTime()]);地带NewRelic的rum.js用于某些路线脚本导轨

问题是,我们让用户主机内容,有时他们举办的html文件。然后是NewRelic的插入这些行的HTML当他们点击下载...

例通过HTML与网站添加NewRelic的下载。任何建议如何剥离新的东西只为特定的路线或任何其他方法,我们只能用于特定的代码路径?

HTTP/1.1 200 OK 
Server: nginx/1.1.8 
Date: Thu, 26 Apr 2012 19:25:54 GMT 
Content-Type: text/html; charset=utf-8 
Content-Length: 1176 
Connection: keep-alive 
Vary: Accept-Encoding 
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.11 
X-UA-Compatible: IE=Edge,chrome=1 
Content-Transfer-Encoding: binary 
X-Runtime: 0.340155 
Progma: cache 
Content-Disposition: attachment; filename="404.html" 
Expires: 0 
Cache-Control: private 
Set-Cookie: ;) 
Status: 200 

<!DOCTYPE html> 
<html> 
<head><script>var NREUMQ=[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> 
    <title>The page you were looking for doesn't exist (404)</title> 
    <style type="text/css"> 
    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } 
    div.dialog { 
     width: 25em; 
     padding: 0 4em; 
     margin: 4em auto 0 auto; 
     border: 1px solid #ccc; 
     border-right-color: #999; 
     border-bottom-color: #999; 
    } 
    h1 { font-size: 100%; color: #f00; line-height: 1.5em; } 
    </style> 
</head> 

<body> 
    <!-- This file lives in public/404.html --> 
    <div class="dialog"> 
    <h1>The page you were looking for doesn't exist.</h1> 
    <p>You may have mistyped the address or the page may have moved.</p> 
    </div> 
<script>(function(){var d=document;var e=d.createElement("script");e.async=true;e.src="https://d1ros97qkrwjf5.cloudfront.net/30/eum/rum.js";var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);})();NREUMQ.push(["nrf2","beacon-1.newrelic.com","9dfe439095",309309,"blablabla==",0,336,new Date().getTime()])</script></body> 
</html> 

我已经尝试使用: 包括:: NewRelic的代理::仪表:: ControllerInstrumentation newrelic_ignore:只=> “下载” 在我的控制器,但它似乎没有任何效果。

当我重新启动我的乘客,代码不附加任何页面一会儿,在这之后,它是所有网页,即使是那些有newrelic_ignore

回答

5

您可以关闭自动仪器新Relic RUM--这就是将JS自动插入到你的页面中的东西。在newrelic.yml中有一个设置可以打开和关闭自动RUM。详细信息请参见documentation for RUM in Ruby

你做到了这一点后,您可以手动添加回仪器为要衡量最终用户的页面加载时间的操作。文档中还介绍了如何执行此操作 - 您可以调用Ruby代理API方法在页面中插入页眉和页脚。

+4

交谈New Relic的客户支持后,这只能在全球范围内完成,然后重新添加独立。 – Michael 2012-10-22 12:44:12

+0

看起来你可以黑名单使用[newrelic_ignore_enduser](控制器https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ignoring-specific-transactions#page-load-timing-rum ) – Arth 2014-12-17 12:25:32