[Go] Custom Events in Go

My colleague @zricezrice and I are having the same problem in our Go app: no results when querying for custom events, but no evidence of errors in the app when recording the custom events.

Has anyone found any solutions to this issue other than to be sure to query FROM <eventType>?

For reference, here is our post regarding the problem in Go: [Go] agent not recording custom event

Hey @weiner.andrew.j and @zricezrice,

I found some success in getting custom events to appear in New Relic via the Go agent by using this example application code.

Once I ran that program, I was able to query custom events with FROM task SELECT * and found some results.

Can you try testing out the above code to ensure you see the events in New Relic, and then you might modify the code to add to your application.

Also, do you see anything related to custom events in the debug logs?

Thanks!

2 Likes

Hi ntierney,

That worked–thank you! I was also able to adjust our own code to make the custom events work as well. I was missing two key pieces:

	// Wait for the application to connect.
	if err := app.WaitForConnection(5 * time.Second); nil != err {
		fmt.Println(err)
	}

and

	// Shut down the application to flush data to New Relic.
	app.Shutdown(10 * time.Second)

Thanks again!

3 Likes

Hello @weiner.andrew.j -

I just wanted to pop in and say thank you for sharing the solution here in the community. We’re grateful to you!