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 too Messy for handle and maintain

custom_attributes

#1

Hi Team, i am exploring new relic with custom attributes, when i used i found too messy to use them.
i have to add below parameter in each function which we have to record parameters.

“NewRelic.Api.Agent.NewRelic.SetTransactionName(“LoginTransaction”, “Login”);”
" NewRelic.Api.Agent.NewRelic.AddCustomParameter(“Login Username is {0}”, username);"

These make too messy to handle and maintain.
There is easy solution for this approach

Any help will be useful.
Thanks in advance.


#2

Hi @gibsmca18 - As these are calls you are making from your own code, you can create a method which would allow you to set a transaction name and parameter.


#3

Hi @gibsmca18,

To add to @stefan_garnham’s info - there isn’t a way to “configure” the collection of an attribute like “username” unless it happens to occur in a query parameter or in a WCF service request parameter. In those cases enabling the collection of request.parameters.* should do the trick.

Otherwise, as @stefan_garnham suggests you’ll have to come up with the most maintainable code level collection of parameters as possible.


#4

Hi @Tjd, sounds good around request.parameters, can you brief this how can i achieve this, as these parameters are query parameters and i want some of these query parameters make attribute through which i can describe actions more clearly.


#5

@stefan_garnham is this possible to do this functionality, in attribute, means i just annotate the function’s and then it will be handle by those filter(s)


#6

@Tjd provided a link on how to allow the enabling of request.paramers in his post @gibsmca18.


#7

@Tjd can you help me with an example, how to use request.parameters, no such documentation found, is this attribute tag configure in new relic agent or in my web.config.

It will be helpful if you provide me sample code.


#8

Have you read the documentation for your agent?

https://docs.newrelic.com/docs/agents/net-agent/attributes/enable-disable-attributes-net


#9

@stefan_garnham, yes i read this but not such clear about.


#10

@RyanVeitch - I think that some assistance from support would be beneficial here.


#11

Thanks for the @ mention @stefan_garnham - I’ll pass this on to our .Net Experts.


#12

@gibsmca18 -

You can try adding the following to your newrelic.config file:

<attributes enabled="true"> 
  <include>request.parameters.*</include>
</attributes>

That should be a direct child of the <configuration> element. An app restart is needed for that config change to take effect.

The wildcard * will cause the collection of all parameters. If you want to be more specific you can change that to:

<attributes enabled="true"> 
  <include>request.parameters.username</include>
</attributes>

or whatever the actual query parameter name is. Keep in mind this configuration only collects parameters passed in the url after ?, e.g. www.example.com?username=ted. If the parameters are sent in the body of the request then this configuration won’t work (although WCF service request parameters should be collected as well).

Does that help?