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

Custom parameter not working


I’m failing to use addCustomParameter on a particular value. However I’m able to add it if I do a substring(0,50) or display it with noticeError.

For example, using the following code I can see v3RequestBody and vR3 but not vR1 nor vR2. LONG_STRING contains a static string which is a copy of what I expect. It only contains ASCII characters.

        NewRelic.addCustomParameter("v3RequestBody", "test");
        NewRelic.addCustomParameter("vR1", request.toString());
        NewRelic.addCustomParameter("vR2", LONG_STRING);
        NewRelic.addCustomParameter("vR3", request.toString().substring(0, 50));

However, putting that same string into a noticeError works flawlessly

        Map<String, String> params = new HashMap<String, String>();
        params.put("Request Body", request.toString());
        params.put("Request Url", this.restConnector.getEndpoint() + urlQuery);
        NewRelic.noticeError("Start checkout failure", params);

But I’m concerned about what would happen if noticeError is called from multiple places and my “request body” disappear? This is a critical value for reproducing production errors.



If your question is regarding the use of noticeError() in case of no “request body” I would like to bring your attention to the different ways in which you can implement noticeError()-

NewRelic.noticeError(Throwable throwable)
NewRelic.noticeError(Throwable throwable, Map<String, String> params)
NewRelic.noticeError(String message, Map<String, String> params)

Also I would like to mention that noticeError is specific to transactions (web or non web) and it works just fine in case of non web transactions.

I was slightly confused by what you meant when you said “if noticeError is called from multiple places and my “request body” disappear?” and if I am unable to understand your question , please help me understand.

Thanks !


There’s really 2 questions in the previous post

  1. why can’t I make this work
    NewRelic.addCustomParameter(“vR1”, request.toString());
    if the following, more verbose code does work
    Map<String, String> params = new HashMap<String, String>();
    params.put(“Request Body”, request.toString());
    params.put(“Request Url”, this.restConnector.getEndpoint() + urlQuery);
    NewRelic.noticeError(“Start checkout failure”, params);

  2. what would happen if there are multiple NewRelic.noticeError calls in the same transaction? Will all values reach new relic as I would expect, or is this the kind of “first call wins” ? In other words, what would happen if I do
    NewRelic.noticeError(“I arrived first”, first);
    NewRelic.noticeError(“I arrived second”, second);
    NewRelic.noticeError(“I arrived third”, third);


Hi @fdematos,

I apologize for the delay in response to your post. I will personally ensure you do not experience such a delay in response again.

Regarding your questions, I would be very interested to see what your logs say about addCustomParameter not working, this could be for a number of reasons, for example, if you are using high security mode, this would prevent the capturing of certain parameters. Would you be willing to take a look into your logs and see if you can see any indication of why this might fail? Also, If could you verify the contents of request.toString() perhaps even insert a String to test this.

Regarding noticeError, that essentially flags an exception to make it visible to newRelic, which is especially useful to track exceptions which you might be handling. For example, if for some reason your transaction has those 3 exceptions occur, they will be reported to us when the transaction ends. It is not a first call wins. I would be very interested in hearing how you would use these multiple calls.


What is high security mode? Can it hide some custom parameters in a transaction while displaying most of them?

I get many custom parameters working on this request, but the most important of them. The documentation for NewRelic.addCustomParameter doesn’t mention but I get a lot of rumours that it has a lenght limit. Also I ran a couple of experiments that confirm it - I tried using a private static final String that had about the same lenght as the String I wanted to send, and it never arrived.

Can you confirm it? if yes, what’s the workaround for such cases? if no, what should I do?


There is information on High Security in our documentation and if you look at you can see how it impacts data like custom parameters.

Let us know if that helps.


Thanks for the link, my problem is definitely not related to high security since it also affects a hardwired constant string that I created for test purposes.

I’m dropping off this forum thing, this is leading me nowhere near my solution after going back and forth 3x. Maybe I’ll try a ticket and see how far that goes…

However I still want to know how many characters I can send in .addCustomParameter() ??? I know it’s not too many.


I know you’ve moved to a ticket, but I’m posting this here so the rest of the world can find the answer when they come looking for it in the future.

For the java agent at least, the maximum length of a custom parameter is 255 characters. So I guess the best workaround in your case is, when noticing an error, split the string into several that are 255 characters long and they can all be reported.

Note that there is also a max of 64 parameters, so this will only take you so far.

Could you let us know if your data is potentially larger than that, so we can create a feature request for sending more?

Feature request or not, I honestly wouldn’t use this functionality to send the data in that case myself - I would timestamp the data and write it to disk, and use a custom parameter to identify the file that it is saved in, so that you can save arbitarily large data - and so that particularly, you’d be able to store every set of useful data (we only accept a limited number of traced errors per minute, per agent) AND so that memory usage of your agent wouldn’t grow without bound (part of the reason we limit parameter data size is so that you don’t end up storing a dozen 20MB traced errors and we use up all of your JVM’s allocated heap space, plus spend over a minute sending us the data when the agent reports in).