Monitoring Tool — New Relic: Concepts + Implementation with gRPC & REST services

Vrushali Raut
3 min readMar 12, 2019

What is New Relic? :-

New Relic is the web application performance service designed to work with your live web app. It's like a performance dashboard with X-ray vision. 💹

It lets you see deep inside your application, across the end user experience within the app itself right down to the code.

We all know it’s frustrating to monitor, troubleshoot and scale a web app, New Relic makes it easy.

New Relic has a lightweight javascript agent that can be sent to end user browsers and can measure the actual time it takes for a page to render.

Its also know as Application performance management tool. (APM)

Understanding APM☺️

APM mainly focus on Hows our application doing?

  • Is it crashing? does it have a lot of errors?
  • Or does it mean it fill too slow to our user
  • Or how many resources have been consumed on the servers?

How does New Relic Application performance monitoring work?

New Relic flow
  • New Relic relies on an application called Language agent.
  • This language agent drills down your code (classes and methods), and that agent calculates the average amount of time that methods take to complete.
  • If errors occur in methods agent trace the stack trace if an error occurs in database agent track the SQL statement.
  • Once per minute this language sends data to New Relic cloud, where the data is organized, and calculations are done and shown to you on your mobile in new relic application or browser in pretty graphs format 📊 📈
  • You can also set alerts for transaction time or resource consumptions exceed or deviate to fat from baselines that you have established. ⌚️

Types of Monitoring New Relic Provide :

  • Application Monitoring:- Code-level monitoring using language agent
  • Server Monitoring:- At the operating system level how much disk space, ram, CPU is being used at each physical server.
  • Browser Monitoring:- Using Javascript lightweight agent running in your end users browser.
  • Mobile Monitoring:- There is a new Relic agent for ios and android that can measure performance and dump crash information for mobile applications.
  • Availability Monitoring:- New Relic visit the URL you specify and let you know URL is not available or returns an error.

How do we integrate it : 📂

When you visit New Relic website you can see there is different language agent like go, ruby, PHP, Java. Follow the instruction for which client you are going to install it. For each language agent, requirements and instructions are clearly mentioned. example (Go: Requirements and Installation instructions)

Finally, you can see the dashboard like this.

Let’s check how to integrate NewRelic with gRPC and REST services.

Add new relic dependency into `build.gradle `

build.gradle

For gRPC service, you need to use @Trace annotation and handle Newrelic exception.

gRPC service

For Rest Service, you need to add Newrelic like this.

How do we exclude some error codes from new relic dashboard :

Follow this on new relic site for your application service

settings -> application -> Server side agent configuration -> Exclude expected errors from error rate

If you have found this useful Click the 💚 below to show your support and share it with other fellow Medium users. stay tuned.

--

--

Vrushali Raut

I’m a Engineer. Ex Spenmo, Gojek, Leftshift . I love to share my experiments, learnings via Blogs. https://twitter.com/vrushaliSRaut