Thanks @verdi and @stefan_garnham for your posts here. This is a great topic for Explorers Hub since many people face this exact Metric Grouping Issue (MGI) hurdle!
I’d first like to direct you to this excellent post by New Relic’s @jfalleur that details what’s going on here.
The best way to solve this is with careful planning and implementation of a good transaction naming scheme using
setTransactionName, opposed to regex matching rules, will make future changes to application code much less likely to break the naming scheme.
Having fewer than 10 unique names will assist in seeing where performance can be improved in your app. Ideally, I’d limit this to the 5 most important types of transactions rather than diluting results across (what can easily become) 1000 names, which then get rolled up into
/* to prevent performance issues in the UI.
Sometimes a big enough MGI can trigger a
deny-new-metrics rule, which does just what it says. It denies new metrics from coming into APM in order to prevent an explosion of unique names. Fortunately, that hasn’t happened for your app, @verdi.
If you do suspect new metrics are not showing up in APM, or if you receive an automated MGI email from New Relic describing as such, definitely contact NR Support to work with us on resolving the MGI and then we can disable that
Below are the Insights queries I use when analyzing an app facing an MGI. Insights is quite useful here because it will show all the transactions hidden behind the rolled up
/* in APM.
- Count of unique names by
Custom (which indicates names set by API calls).
SELECT uniqueCount(name) from Transaction where appId = [your appId] since 1 week ago facet transactionSubType
- The same as number 1, but viewed over time.
SELECT uniqueCount(name) from Transaction where appId = [your appId] since 1 week ago facet transactionSubType TIMESERIES max
- Unique names with
socket somewhere in the name.
SELECT uniques(name) from Transaction where appId = [your appID] since 1 week ago LIMIT MAX where name LIKE '%socket%'
setTransactionName can be a useful to for renaming transactions with a lot of variation in their names, sometimes it is equally useful to ignore certain transactions altogether. To accomplish that, I recommend utilizing the
newrelic.js config file where we can add a section like this:
FYI, here’s a default config file with all available options listed:
Happy renaming and ignoring!