Start instrumentation programatically with global newrelic.config only

Disclaimer: I am a Java rather than a .NET developer, but have to tinker on a .NET integration component from time to time, so please bear with me.

We have some .NET components (.dll) that are invoked from a legacy COM application. It seems to me New Relic .NET Agent (6.1.48.0) is not able to automatically instrument these invocation. I’m therefore looking into explicitly triggering New Relic instrumentation from our .NET code.

For testing the set up I’m trying to start New Relic from a NUnit test case, which I believe may reflect the runtime environment challanges in that it is a non-IIS application and there is no app.config (or can there be???).

In my global newrelic.config I have
<service licenseKey="..." ssl="true" sendDataOnExit="true" />
I have tried with and without syncStartup="true" and autoStart="false". All else is the default.

In my NUnit test case I have
NewRelic.Api.Agent.NewRelic.SetApplicationName("NUnit proof of concept"); // Tried without this
NewRelic.Api.Agent.NewRelic.StartAgent();
NewRelic.Api.Agent.NewRelic.SetTransactionName("Custom", "NUnit tx");
System.Threading.Thread.Sleep(61000); // Make sure application lives for 60 seconds

However no logs are created in my local Logs dir and no data turns up in the web UI.

I have read these two threads but nothing in there made any difference.
What am I doing wrong? Is what I’m trying to achieve at all possible?

Hello @mattiasj,

Assuming that the .NET application you’re trying to monitor meets the compatibility requirements for being monitored, the process for monitoring non-IIS applications is essentially as follows.

  1. When installing the .NET agent, make sure you select the “Instrument All” feature in order to allow the agent to profile localized .NET applications
  2. Configure the agent to target your application for monitoring either through the application’s app.config file, or the global newrelic.config file located at C:\ProgramData\New Relic\.NET Agent (After this step is complete you should see logs being generated in the logs folder)
  3. Create custom transactions to define what methods in the application define the scope of a transaction and what is important to be monitored.

Perhaps the best way to get an overview of this process is through this forum post which walks through what is needed to get a non-IIS application configured to report data to New Relic servers.

If you need any help at all, please don’t hesitate to ask. That’s what we’re here for.

Thanks,

Don