How set context in new transaction manually for APM Agent .NET Framework

Hi, I'm instrumenting an app manually because it uses the windows self-host to run as a local service, when creating a new transaction how can I get the content of the body and set it manually in the new transaction?

The objective is to know the information that the client passes to an api when there is an object reference error.

The body is stored in the transaction.Context.Request property - in general things that the agent stores on specific events is on the Context.

So you'd do something like this:

transaction.Context.Request = new Request(method, new Url{Full = url}){Body = "[SET BODY HERE]"};

Remaining question is, how do you get the URL values, the method and the body itself. I don't know the specifics of your app, but don't you have access to the static HttpContext property? These things are usually stored there. So, ideally you'd be able to read the values via the HttpContext and just store those on Transaction.Context.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.