AnandhaSundari M
AnandhaSundari M

Reputation: 1108

Custom Events in NewRelic ASP.NET

I am monitoring ASP.NET web Application with NewRelic. I am trying to insert a custom event with the following code.

var eventProperties = new Dictionary<string, object>();
eventProperties.Add("Time", DateTime.Now);
NewRelic.Api.Agent.NewRelic.RecordCustomEvent("Custom/Record_Event",eventProperties);

I dont know how to view this event in the NewRelic dashboard. Whenever I create a custom metric, I can view it by creating a chart/table in a custom dashboard. But, I have not found any way to view Custom events. I tired using NRQL, but I found only predefined pageviews and transactions not custom events. Please help.?

Note: I am using NewRelic Pro Trial.

Upvotes: 0

Views: 1123

Answers (1)

James
James

Reputation: 377

I know this is a late reply, but it might help those who are Googling for this problem later on.

If you used RecordCustomEvent("MyEventName", myEventAttributes), then you can use NRQL as:

SELECT * from MyEventName SINCE 1 hour ago

(or "3 days ago" etc.)

The "Custom" naming scheme (where you prefix all names with "Custom/" only applies to metrics, not custom events. Check out the specs for the event name argument:

The name of the event type to record. Only the first 255 characters are retained. The name can only contain alphanumeric characters, underscores _, and colons :.

That means the "/" in your name "Custom/Record_Event" is against spec, and thus doesn't get logged. You might see a note about it in your NewRelicAgent logs.

Are you able to get metrics showing in your custom dashboard? If so, then I think just renaming your event will work. If not, you'll need to double check the NewRelic logs and make sure you aren't triggering errors that prevent anything from getting sent.

Finally, I should note that I use the fully licensed version of NewRelic, so it's possible you're trying out functionality that is disabled for unlicensed users.

Upvotes: 1

Related Questions