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

Feature request - NRQL string functions



I hit a nasty “wall”:

  • doing a chart for specific 4 transactions
  • their names in insights are like "WebTransaction/Custom/api / % / %’
  • doing a pie chart (here or with a 4rd party board system) the names are truncated “WebTransaction/Custo…”.

It would be nice to have string functions I would manually replaced the extra string … OR the query results to be Auto Smart and remove the duplicated text (in this case "WebTransaction/Custom/api / "

Live example from a insights board :

Thanks and keep up the good job.

New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

Feature request - NRQL string CONCAT function
Feature Idea: Common string manipulation functions (i.e. right, left, subtring, etc)
String functions in NRQL?
Acknowledging Incident Directly from Insights Dashboard
Feature Idea: Error: Job Timed-out After 180

Hi @adrian_georgesc great suggestions here - as a workaround, have you tried making the widget that shows the pie chart as wide as your screen allows? Does it then show you the full transaction name, or does it still truncate?


It shows the name, the truncate is done by the widget, I solved the problem by using a transaction parameter, putting there the tsimple text and changing the query.


I like to second the request for string functions, in particular to transform values of attributes before using them in a facet so that I can treat multiple transaction names that follow a certain pattern (<category>.<specific name>) the same (group by category) without having to introduce custom attributes (not possible on many servers in our setup).


Thank you @jnicolai - I have added your feature request including those details.


Please paste the permalink to the page in question below:

Please include any NRQL you are using:

SELECT COUNT(*) AS SlowTimes FROM Transaction WHERE (totalTime - externalDuration) > 3 SINCE 1 HOUR ago FACET name

Please share your question/describe your issue below. Include any screenshots that may help us understand your question:

Is there any way to not select the entire “name” when running this NRQL?
Examples of the “name” fields returned are:


We are only concered with the last part and would like this to be returned instead:


This way everything might fit on the screen!



Hi @mmcginty - this has already been posted as a feature request. Pop over and add your vote.


Hey @mmcginty, I went ahead and submitted a new feature request for you, and merged your topic with this one. Feel free to vote in the poll above, and let me know if there are any details you would like me to add to the feature request!


I too would love to this feature in NRQL and more. Not just string functions but also number functions and other neat functions too.

We need more votes!


I would like this too, I’d like to facet by right(monitorName,2) so that I can use the country code we use in the monitor name to group data. But a substring, left, and replace function would be equally as useful. An example of a full query using this is:

SELECT ((percentage(count(*), WHERE duration <= 7000 and result = 'SUCCESS' )+percentage(count(*), WHERE (duration > 7000 and duration < 28000) and result = 'SUCCESS' )/2))/100 as 'APDEX Score' FROM SyntheticCheck SINCE 30 days ago FACET right(monitorName,2)

Using the data set:

Monitor 1 EU Monitor 1 NA Monitor 2 EU Monitor 2 NA


I found FACET CASES clause works well for the scenario.

Ability to use string functions applied to facet'd column?

Thank you Yiiu, I’ve learnt something new today, however it’s not quite working as I had expected or hoped YET, am I doing something wrong?:


SELECT count(error) 
FROM SyntheticCheck 
  CASES(where monitoName LIKE '%EU%' AS 'EU'
       ,where monitoName LIKE '%NA%' AS 'NA')
SINCE 30 days AGO


| 2	| , TaskTimedOut: Task timed-out waiting for element to be located using: By.linkText("LOGIN") |


Some basic string functions would be extremely useful. We have a search field and I’m trying to pull a list of most searched terms. But I want search term and search term to be counted together (i.e. trim()) . I’d also like to exclude noise, like < 2 char terms (i.e. length()).

If there’s a workaround I’d love to hear it.


I see the second term was truncated in my reply :slight_smile:

But for clarity, the second search term had a trailing space in my reply, the formatting trimmed the space.


Can you mock up a sample of your NRQL? You might be able to facet by more than one item to get the effect.


SELECT uniqueCount(`account_id`) FROM AppEvent WHERE event='SEARCH_TERM' AND FACET `KEYWORD` LIMIT 50 since 1 week ago

As mentioned in the post, where 2 search terms are the same but for trailing spaces I’d like to combine them, and also remove noise like single character or 2 character searches.

Something like this is what I’m after, if it can be done with fancy FACETs I’m keen to hear:

SELECT uniqueCount(`account_id`) FROM AppEvent WHERE event='SEARCH_TERM' AND LENGTH(`KEYWORD`) > 2) FACET TRIM(`KEYWORD`) LIMIT 50 since 1 week ago


Don’t think a facet would help with your case unless your terms were not completely random. Seeing your attributes shows they are probably custom so I suppose the most robust solution is to address it at the time the attributes are set. You can trim the values in your app code (add a second attribute that is trimmed maybe) and you can also add an attribute for length. I know its not the best solution. This is one of those areas where we would like new relic to be closer to a reporting or business analytics tool than a monitoring tool. We do the same kind of thing.

I’d also caution about the potential accuracy of using a limit of 50 and counting unique where there can actually be many more terms in the time window. I’m not sure if you are doing this in practice or if it was just the sample. I have found at times the short list isn’t accurate depending on the query. For many things that is not important for monitoring, but it could be important when we are are looking at account id’s. I’d just suggest double checking the numbers so you know if they are accurate enough.


It would be nice to have a CONCAT function
e.g. generate a url from an id in a custom attribute


Thanks for commenting @alessio.franceschell - I’ll get your +1 added for Concat functionality


+1 to wanting string splitting / interpolation with sub query support.

String functions in NRQL?