Using the New Relic with Sitecore

I am testing a new relic with Sitecore CMS. All New Relic web transactions are sent to the element layout file, so I cannot expand the part details in New Relic.

I am trying to use the new Relic API to call SetTransactionName and set it to the URL of the elements, but I cannot get it to work. I created the httprequestbegin pipeline processor, and I put it right at the end, right after:

 <processor type="Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel"/> 

I have the New Relic API assembly installed, as well as in the bin folder. Here is a line of code I'm trying to run.

 NewRelic.Api.Agent.NewRelic.SetTransactionName("Custom", Sitecore.Context.RawUrl); 

Any ideas what I might be doing wrong? All web transactions are still displayed as the item layout file.

+4
source share
3 answers

I set the transaction name in the httpRequestProcessed pipeline and this works. I started using httpRequestBegin , but I found that it does not work every time. Also, remember that your request must take more than 500 ms to complete before NewRelic picks it up.

Additional integration points that I made with Sitecore:

  • Log4Net Appender that reports NewRelic using NoticeError
  • HttpModule collects Application_Error and raises NewRelic with NoticeError
  • Use the element path to name transactions, and use AddCustomParameter to add language, database, user, etc.
+1
source

There is a module on the market that sorts all of this:

http://marketplace.sitecore.net/en/Modules/New_Relic.aspx

+1
source

We had similar problems when we started using New Relic with our Sitecore app about 18 months ago. Unfortunately, no one used the new relic with Sitecore at the time. We settled on adding the following code to the base class of the page that every page of our site inherits:

  // --- Set custom transaction name for New Relic. NewRelic.Api.Agent.NewRelic.SetTransactionName("Pages", Sitecore.Context.Item.Template.FullName)); // --- Set custom parameter to store raw url to assist with diagnostics. NewRelic.Api.Agent.NewRelic.AddCustomParameter("RawUrl", Request.RawUrl); 

For our application template names, it’s enough to distinguish between trends, and we added a custom parameter to fill in the whole RawUrl (we noticed weird things when New Relic didn’t capture the full URL for us, it might not be that long).

0
source

Source: https://habr.com/ru/post/1489839/


All Articles