Aggregation of Custom Metrics

  • New Relic Agent v7.1.0.187 (Running on PHP 5.5.9)

Just wondering, I’ve been having issues in our app where we’re getting these kinds of traces.
To me, I know this is specifically our app waiting on the session to unlock, but it’s not clear enough in the trace details about where it’s actually hanging.

Relatedly, there’s multiple parts to a request which I’d like to monitor the time taken on, for example, routing, authentication, template generation, etc.

So I’ve been mucking around with custom metrics to record performance at certain points of web requests, and I’d like to combine then to get an understanding of how much each point of processing takes compared to the full request. (Answering: "How long did it take (on average) to make a web request? Out of that time, how long did it take to process routing, then process dispatching?)

I’m rather new to New Relic, so I’m wondering if I might be missing something that could help me do this?
The metric graph is useful, but it’s showing metric times as standalone plots, what I would like to see is something like the web transactions time graph, where it can display the request, but also show where time in that request was spent.

@Nessworthy Application Code in PHP Agent traces is generally inline PHP code. The PHP Agent doesn’t time core PHP functions, otherwise it would be timing every line of code, so every custom function is timed.

If you have inline PHP code then a custom function is called, The PHP Agent needs to define that time in the trace, so we call it Application Code. So if this time in particular is high, we generally recommend refactoring that inline code into functions per the task each part of the code is doing. If you wrap this code into functions and then call those functions, because they are custom functions our agent will automatically time and report it in traces.

If the inline code doesn’t really fall into tasks it’s achieving, divide and conquer is a good approach too, where you wrap the top half in a function and a bottom half in a function and whichever function is slow is the problematic area. Rinse and repeat.

This only really occurs for inline PHP code where it’s core PHP code and we have to group this time into some useful way. I address this in a bit more detail on this thread. I hope that helps you achieve your goal.