APM tracing requests JSON capture

hello
I am quite new to new relic, so far I like what I see, but is it possible to also capture the API request too when tracing I see the URL but would like to see the request too as it contains info I need

e.g. our api gets requests like
{
“PlayerID”:“1231231”,
“Email”:“1231231@fff”,
“Name”:“Jack”,
“Surname”:“Brown”,
“CountryCode”:“US”
}

would be good to capture that too

we use azure web services and .net framework

Hello @Chris68,

Welcome to New Relic, we are happy to have you here! Yes, it is possible to capture the API request, I would suggest using the AddCustomAttribute on the [ITransaction] API: https://docs.newrelic.com/docs/agents/net-agent/net-agent-api/itransaction#addcustomattribute:

Adds contextual information about your application to the current transaction in the form of attributes.

You could do something like:

IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent(); 
ITransaction transaction = agent.CurrentTransaction; 
transaction
    .AddCustomAttribute("PlayerID","1231231")

Let me know if you have any questions!

5 Likes

Thanks seems like a good option i will have a play tomorrow

i cant seem to get this working, my coding skills not great…

basically, i added newrelic api and agent to project its a .net framework added
IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent();
ITransaction transaction = agent.CurrentTransaction;
transaction
.AddCustomAttribute(“PlayerID”,“1231231”);

and says:
The type or namespace name ‘IAgent’ could not be found (are you missing a using directive or an assembly reference?)|

and

The type or namespace name ‘ITransaction’ could not be found (are you missing a using directive or an assembly reference?)

but in my references I have NewRelic.Api.Agent

basically says on web add the dll and it should work but does not seem to work, any help would be great