Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Chart a particular (internal) API call across all transactions on a dashboard


#1

Similar question I posted before reading this – is it possible to chart a particular (internal) API call across all transactions on a dashboard (vs a particular transaction and all the underlying API calls stacked)


Finding slow function calls across all transactions
#2

Hi Edward,

We might need a bit more context to address that most directly. When you say “internal API call”, what do you mean? Does our agent currently see this as a transaction of its own (vs as a function call within a stack trace or breakdown of top time consumers within another transaction)? Is it an external API call (eg, shows up in the list of Externals)? If you could post a permalink to a dashboard that does exist and call out a particular function name, it might be useful.

My guess without the more context is that you are talking about a function call (eg BasicDataSource.getConnection() from your original post) and that is impossible to do without some additional instrumentation in your code (Externals, and other self-contained transactions on the other hand are easy and we do already have that info and can help you graph it).

On the up side, what I describe is totally possible if you have the ability to modify the source code. One way to do it is to make a wrapper function in your code that just calls the desired function, in which you could do something like:

long start = System.nanoTime();
BasicDataSource.getConnection();
long end = System.nanoTime();
long microseconds = (end - start) / 1000; 
NewRelic.recordMetric("Custom/functiontiming/getConnection", microseconds);

…and then you could create a custom dashboard showing just that metric. You can tweak this to give you more info - eg, using different metric names that you can match with a single wildcard (which works best in our custom dashboards) to be able to show different categories in a graph:

NewRelic.recordMetric("Custom/functiontiming/BasicDataSource/getConnection", microseconds);
NewRelic.recordMetric("Custom/functiontiming/AdvancedDataSource/getConnection", microseconds);

…and graph the metric “Custom/functiontiming/*/getConnection” to get a stacked area chart of the different getConnection() calls. Or if you were getting really fancy, you could put a simplified version of the caller’s name into there, so you could get a graph split up by caller.

I realize you were hoping for “we can slice and dice existing data” but I think this is the best we can do. Let me know if I guessed wrong about your goals and I’d be happy to try again.