Esempio n. 1
0
func (t *Tracer) BeginTrace(name string) *Trace {
	tracerName := "Trace/" + name
	m := t.metrics[tracerName]
	if m == nil {
		t.metrics[tracerName] = &TraceTransaction{tracerName, metrics.NewTimer()}
		m = t.metrics[tracerName]
		m.addMetricsToComponent(t.component)
	}
	return &Trace{m, time.Now()}
}
Esempio n. 2
0
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
}
Esempio n. 3
0
//Initialize global metrics.Timer object, used to collect HTTP metrics
func (agent *Agent) initTimer() {
	if agent.HTTPTimer == nil {
		agent.HTTPTimer = metrics.NewTimer()
	}
}