2012-04-26 52 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