示例#1
0
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.NewrelicLicense = *newrelicLicense
	agent.Run()

	doSomeJob(100)
}
示例#2
0
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.Run()

	http.HandleFunc("/", agent.WrapHTTPHandlerFunc(helloServer))
	http.ListenAndServe(":8080", nil)

}
示例#3
0
func New(license string, appname string, verbose bool) *Gorelic {
	if license == "" {
		panic("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 &Gorelic{agent}
}