Exemplo n.º 1
0
func (w *gometricsWrapper) Event(e trace.Event) {
	if m := e.Metric(); m != "" {
		if de, ok := e.(trace.TimespanEvent); ok {
			w.time(m, de.Duration())
		} else {
			w.count(m)
		}
	}
}
Exemplo n.º 2
0
func (w *appdashWrapper) Event(e trace.Event) {
	if se, ok := e.(trace.HttpServerEvent); ok {
		if se.Duration() > 0 {
			sse := httptrace.NewServerEvent(se.ServerRequest())
			sse.ServerRecv = se.Start()
			sse.ServerSend = se.Start().Add(se.Duration())
			w.rec.Event(sse)
		}
	} else if de, ok := e.(trace.TimespanEvent); ok {
		if de.Duration() > 0 {
			w.rec.Event(&spanEvent{Span: de.Message(), ClientSend: de.Start(), ClientRecv: de.Start().Add(de.Duration())})
		}
	} else {
		w.rec.Msg(e.Message())
	}
}
Exemplo n.º 3
0
Arquivo: log.go Projeto: jfbus/trace
func (w *log15Wrapper) Event(e trace.Event) {
	lvl := trace.LvlDebug
	if ce, ok := e.(trace.LevelEvent); ok {
		lvl = ce.Level()
	}

	switch lvl {
	case trace.LvlCrit:
		w.log.Crit(e.Message(), log.Ctx(e.Context()))
	case trace.LvlErr:
		w.log.Error(e.Message(), log.Ctx(e.Context()))
	case trace.LvlWarn:
		w.log.Warn(e.Message(), log.Ctx(e.Context()))
	case trace.LvlInfo:
		w.log.Info(e.Message(), log.Ctx(e.Context()))
	default:
		w.log.Debug(e.Message(), log.Ctx(e.Context()))
	}
}