Setup New Relic Scheduled Task

This tutorial introduce setup process for scheduled tasks in New Relic tool.  This tutorial assume that New Relic .NET agent is installed and running.

First of all we need to locate file called “CustomInstrumentation.xml”. Usually it can be found under “_installation_path_\New Relic\.NET Agent\Extensions” folder. If this file does not exist, please create one.

The content should be following (just copy paste):

<?xml version=”1.0″ encoding=”utf-8″?>
<extension xmlns=”urn:newrelic-extension”>
<instrumentation>

</instrumentation>
</extension>

Now let’s assume we have a scheduled task with following code:

In addition New Relic requires from us to define application app config file (in my case is : NRConsoleApplicationTest.exe.config)

Now it’s a good time to update “CustomInstrumentation.xml” with scheduled task definition (copy paste, overriding previous definitions):

And then we run it:

After small amount of time we should see in APM web interface:

The reason that it takes time to see cheduled task data in APM console its because data provided by New Relic agent needed to be submited to the NEW Relic server

When opening Transaction tab, we will see following:

In case of data not appears in APM console, verify following:

  1. Make sure New Relic .NET agent is up and running
  2. Is new relic activated in application config file(in my case: NRConsoleApplicationTest.exe.config)
  3. Is log file created for your scheduled task (_installation_path_\New Relic\.NET Agent\Logs)
  4. Make sure you have entry “Sending data before process termination” in log file mention above.
    • If this string does not appear, meaning you task is too long/short/infinite and New Relic agent can not submit data to it’s servers.

Happy profiling !

Leave a Reply

Your email address will not be published. Required fields are marked *