[Ruby] Custom Events does not show up on NR dashboard

I am using Ruby SDK of New Relic. I have followed the documentation and I did as it instructs.

  • NewRelic::Agent.config[:'custom_insights_events.enabled'] is true.

  • sql SELECT message FROM NrIntegrationError WHERE newRelicFeature = 'Event API' AND category = 'EventApiException' shows nothing.

  • My application is enabled for tracing because I am able to see other transactions.

I am trying the following code several times to warm up New Relic side:

::NewRelic::Agent.record_custom_event('WidgetSale', color: 'red', weight: 12.2)

This shows nothing: 
`SELECT * from WidgetSale`

Where am I wrong?

Hi, @mehmet4: Try just:

SELECT * FROM NrIntegrationError

You are not actually using the Event API. Also, how long does your application run? The Ruby agent sends its data once per minute; if your application does not run for at least a minute, it is possible that it is ending before the agent can send its data.

Thanks @philweber ,

This shows nothing;

SELECT * FROM NrIntegrationError

I pushed much more events 3 hours ago. I have checked it through NRQL and it shows nothing.

Did you see my other comment, that your application must run for at least one minute?

@philweber, the application is working for almost 1 year. Or do you mean pushing custom event for 1 minute? Yes.

@philweber I have tried this buggy code which contains reserved keywords.

1000.times { sleep 0.1 ; ::NewRelic::Agent.record_custom_event('WidgetSale', where: 'red', and: 12.2)}

Still SELECT * FROM NrIntegrationError shows nothing.

Sorry, I don’t have any other suggestions. Hopefully a member of our support team or the community will be able to help.

@philweber This is a bit urgent.

Thank you for your continuous support @philweber.

@mehmet4, I believe you were able to resolve the issue over a ticket (456091). Just for other users, if they face a similar problem, we wouldn’t expect the API methods record_custom_event or record_metric to be sent to New Relic from the Rails console as the agent has a default configuration autostart.denylisted_constants set to not start in the Rails console:

Later you were able to resolve the issue by adding the record_custom_event in your application code rather than the Rails console.

Please feel free to mark this as solved if your issue is resolved.


1 Like

@mlavania thanks. Yes, I resolved it.


This is really not clear or apparent though. Can this be added to the Ruby/Rails documentation and/or troubleshooting pages.


1 Like

I was able to get the agent to start by setting the environment variable NEW_RELIC_AGENT_ENABLED=true.

> NewRelic::Agent.agent.has_correct_license_key?
> NewRelic::Agent.agent.started?

But even with that, NewRelic::Agent.increment_metric('Custom/My/Metric') doesn’t seem to get sent to New Relic.

This topic was automatically closed after 364 days. New replies are no longer allowed.