HI Guarav1,
Yes, there is a minimum time that the application must run in order for the agent to collect data and send it to New Relic. The agent’s “harvest cycle” is one minute. If the application does not run for at least this amount of time, any data collected will be lost when the service (and by extension, the agent) shuts down.
If your application runs for less than one minute, you can configure the agent to halt the service from shutting down long enough for it to send the data it has collected so far. To do this, you need to set the sendDataOnExit
and sendDataOnExitThreshold
service elements in your newrelic.config file.
The sendDataOnExit
element tells the agent to hold the shutdown of the process until it can send off the data it has collected.
The sendDataOnExitThreshold
element sets the minimum amount of time, in milliseconds, that the application must run before the sendDataOnExit
requirement is enforced.
For example, if you wanted to set the agent to send it’s data on exit if your application ran for at least one second, you would edit the newrelic.config file <service>
element to resemble the following:
<service licenseKey="YOUR_LICENSE_KEY" [etc...] sendDataOnExit="true" sendDataOnExitThreshold="1000" [etc...] >
Once these configurations are in place, restart your host service (WCF, IIS, etc.) to force the agent to pick up the changes.
Hope this helps.
Don