func InitNewrelicAgent(license string, appname string, verbose bool) error { if license == "" { return fmt.Errorf("Please specify NewRelic license") } agent = gorelic.NewAgent() agent.NewrelicLicense = license agent.HTTPTimer = metrics.NewTimer() agent.CollectHTTPStat = true agent.Verbose = verbose agent.NewrelicName = appname agent.Run() return nil }
func main() { flag.Parse() if *newrelicLicense == "" { log.Fatalf("Please, pass a valid newrelic license key.\n Use --help to get more information about available options\n") } agent := gorelic.NewAgent() agent.Verbose = true agent.CollectHTTPStat = true agent.NewrelicLicense = *newrelicLicense agent.AddCustomMetric(&WaveMetrica{ sawtoothMax: 10, sawtoothCounter: 5, }) agent.Run() http.HandleFunc("/", agent.WrapHTTPHandlerFunc(helloServer)) http.ListenAndServe(":8080", nil) }