Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to differentiate Rails API calls in Newrelic?

I'm using Rails 5 to serve a website and a RESTful API, and I use Newrelic (newrelic_rpm gem) to monitor the application performance.

At the moment, the gem monitor to all requests to one application name.

let's say my routes looks something like:

Rails.application.routes.draw do
  resources :users
  namespace :api do
    namespace :v1 do
      resources :users, only: :index
    end
  end
end

Here /users is the route for the web app and api/users is the route for the API. For now, once I use newrelic_rpm it won't see the different between the API and the web.

I want to make more separation for the reports so I can log web requests to a specific app name, ex: web_app and for the API another name api_app.

Any help?

like image 875
Eki Eqbal Avatar asked Apr 27 '17 04:04

Eki Eqbal


1 Answers

You cannot do what you have outlined here with the current version of the New Relic agent. That's not how the agent works; that's not how New Relic works.

You have a single application whose performance should be considered as a whole. If you were able to route the performance data to different apps, how could you see that a problem in one app is affecting the other app? How can you correlate events and metrics when they are in separate apps?

More specifically, someone could attack app A and negatively impact app B, and that might appear in the performance data for app A, app B, or both. That's why this isn't supported: you don't put up artificial walls in the performance data for a single app running on a single server.

Use the agent the way it was intended, and use the New Relic transactions page in APM and the Web transactions analysis report to filter down to the transactions you care about. You can also use the Insights event explorer to filter and chart your Transaction data.

like image 108
anothermh Avatar answered Nov 03 '22 20:11

anothermh