This repository showcases how to make a Go app that runs on Clever Cloud observable using New Relic Agent.
This project uses gomod
to build. Add the following environment variable in Clever Cloud Console to deploy this app:
CC_GO_BUILD_TOOL="gomod"
The installation process is explained in New Relic's doc for Go or can be done by following the step by step instructions provided by the Guided Install from your New Relic account.
Both processes are the same, except the Guided install will already contain your Licence Key in the code, which is convenient.
From your New Relic home's account, go to the left menu options, click on Add data >Guided Install.
Chose APM (Application Monitoring), then select Go.
Follow the steps to import the agent into your Go application.
The code in main.go
contains the code in a new init
block. You can also add it your main
function. Both options are viable.
Don't forget to run go run .
to compile and deploy before pushing your code.
🚀 You don't need to complete step 7 when deploying on Clever Cloud, as the runtime will read your code and get the agent automatically.
If your project uses a Go version that is not yet supported on Clever Cloud, specify the full version (ex: go 1.22.0
instead of go 1.22
)in go.mod
like in this example. It will work out of the box with the specified version regardless of server configurations.