// Trace returns a new entry with a Stop method to fire off
// a corresponding completion log, useful with defer.
549030
func (l *Logger) Trace(msg string) *Entry {
	return NewEntry(l).Trace(msg)
}
1057116
func (r Req) Trace(span opentracing.Span) {
	span.SetTag("key", r.MKey)
	span.SetTag("target", r.Target)
	span.SetTag("pattern", r.Pattern)
	span.SetTag("from", r.From)
	span.SetTag("to", r.To)
	span.SetTag("span", r.To-r.From-1)
	span.SetTag("mdp", r.MaxPoints)
	span.SetTag("rawInterval", r.RawInterval)
	span.SetTag("cons", r.Consolidator)
	span.SetTag("consReq", r.ConsReq)
	span.SetTag("schemaId", r.SchemaId)
	span.SetTag("aggId", r.AggId)
	span.SetTag("archive", r.Archive)
	span.SetTag("archInterval", r.ArchInterval)
	span.SetTag("TTL", r.TTL)
	span.SetTag("outInterval", r.OutInterval)
	span.SetTag("aggNum", r.AggNum)
}
665502
func (h *HandlerT) StopGoTrace() error {
	h.mu.Lock()
	defer h.mu.Unlock()
	trace.Stop()
	if h.traceW == nil {
		return errors.New("trace not in progress")
	}
	log.Info("Done writing Go trace", "dump", h.traceFile)
	h.traceW.Close()
	h.traceW = nil
	h.traceFile = ""
	return nil
}
63317
func (s *EventStore) StopTracing() {
	s.traceMu.Lock()
	defer s.traceMu.Unlock()

	s.tracing = false
}
594182
func trace(ctx context.Context, subsystem, name string) (opentracing.Span, context.Context) {
	span, ctx := opentracing.StartSpanFromContext(ctx, name)

	span.SetTag("subsystem", subsystem)

	// This is slightly confusing: when tracing is disabled, trace spans
	// are still created - but the tracer used is a NOP. Therefore, only
	// display the message when tracing is really enabled.
	if tracing {
		agentLog.Debugf("created span %v", span)
	}

	return span, ctx
}
988602
func RecordTrace(w io.Writer, trace *RequestTrace) {
	attempt := AttemptReport{
		Reused:     trace.Reused,
		Latency:    trace.Finish.Sub(trace.Start),
		ReqWritten: trace.RequestWritten.Sub(trace.Start),
	}

	if !trace.FirstResponseByte.IsZero() {
		attempt.RespFirstByte = trace.FirstResponseByte.Sub(trace.Start)
		attempt.WaitRespFirstByte = trace.FirstResponseByte.Sub(trace.RequestWritten)
	}

	if !trace.Reused {
		attempt.DNSStart = trace.DNSStart.Sub(trace.Start)
		attempt.DNSDone = trace.DNSDone.Sub(trace.Start)
		attempt.DNS = trace.DNSDone.Sub(trace.DNSStart)

		attempt.ConnectStart = trace.ConnectStart.Sub(trace.Start)
		attempt.ConnectDone = trace.ConnectDone.Sub(trace.Start)
		attempt.Connect = trace.ConnectDone.Sub(trace.ConnectStart)

		attempt.TLSHandshakeStart = trace.TLSHandshakeStart.Sub(trace.Start)
		attempt.TLSHandshakeDone = trace.TLSHandshakeDone.Sub(trace.Start)
		attempt.TLSHandshake = trace.TLSHandshakeDone.Sub(trace.TLSHandshakeStart)
	}

	_, err := fmt.Fprintln(w,
		"Latency:",
		attempt.Latency,

		"ConnectionReused:",
		fmt.Sprintf("%t", attempt.Reused),

		"DNSStartAt:",
		fmt.Sprintf("%s", attempt.DNSStart),
		"DNSDoneAt:",
		fmt.Sprintf("%s", attempt.DNSDone),
		"DNSDur:",
		fmt.Sprintf("%s", attempt.DNS),

		"ConnectStartAt:",
		fmt.Sprintf("%s", attempt.ConnectStart),
		"ConnectDoneAt:",
		fmt.Sprintf("%s", attempt.ConnectDone),
		"ConnectDur:",
		fmt.Sprintf("%s", attempt.Connect),

		"TLSStatAt:",
		fmt.Sprintf("%s", attempt.TLSHandshakeStart),
		"TLSDoneAt:",
		fmt.Sprintf("%s", attempt.TLSHandshakeDone),
		"TLSDur:",
		fmt.Sprintf("%s", attempt.TLSHandshake),

		"RequestWritten",
		fmt.Sprintf("%s", attempt.ReqWritten),
		"RespFirstByte:",
		fmt.Sprintf("%s", attempt.RespFirstByte),
		"WaitRespFirstByte:",
		fmt.Sprintf("%s", attempt.WaitRespFirstByte),
	)
	if err != nil {
		fmt.Fprintf(os.Stderr, "failed to write request trace, %v\n", err)
	}
}
1103468
func (t LoggerType) Trace(errin error) {
	if errin == nil {
		return
	}

	msgopts, err := t.options.Formatter.formatSkip(errin.Error(), 1, true)
	if err != nil {
		t.options.FallbackLogger.Trace(ErrSlackFormatFailed1.New(err, errin.Error()))
		t.options.FallbackLogger.Trace(errin)
		return
	}

	t.sendMessage(t.options.ChannelError, msgopts...)
}
561720
func (r Req) TraceLog(span opentracing.Span) {
	span.LogFields(
		log.Object("key", r.MKey),
		log.String("target", r.Target),
		log.String("pattern", r.Pattern),
		log.Int("from", int(r.From)),
		log.Int("to", int(r.To)),
		log.Int("span", int(r.To-r.From-1)),
		log.Int("mdp", int(r.MaxPoints)),
		log.Int("rawInterval", int(r.RawInterval)),
		log.String("cons", r.Consolidator.String()),
		log.String("consReq", r.ConsReq.String()),
		log.Int("schemaId", int(r.SchemaId)),
		log.Int("aggId", int(r.AggId)),
		log.Int("archive", r.Archive),
		log.Int("archInterval", int(r.ArchInterval)),
		log.Int("TTL", int(r.TTL)),
		log.Int("outInterval", int(r.OutInterval)),
		log.Int("aggNum", int(r.AggNum)),
	)
}
171835
func (l *Logger) Trace(v ...interface{}) {
	if l.getLevel() <= Trace {
		l.getHandler().Log(l.name, Trace, fmt.Sprint(v...), 1)
	}
}
1131805
func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route {
	return g.Add(http.MethodTrace, path, h, m...)
}
354909
func (l *Logger) Tracef(format string, v ...interface{}) {
	if l.trace {
		l.logger.Printf(l.traceLabel+format, v...)
	}
}
343927
func (logger *Logger) Tracef(m string, args ...interface{}) {
	logger.log(TRACE, m, args...)
}
392133
func (err *cmnError) Trace(offset int, format string, args ...interface{}) Error {
	msg := fmt.Sprintf(format, args...)
	return err.doTrace(msg, offset)
}
869961
func Trace(pattern web.PatternType, handler web.HandlerType) {
	DefaultMux.Trace(pattern, handler)
}
1141375
func (g *routeGroup) Trace(path string, h ...Handler) {
	g.handle(TRACE, path, h)
}
1287173
func (logger *Logger) Tracef(format string, args ...interface{}) {
	logger.log(TRACE, fmt.Sprintf(format, args...))
}
162930
func (e *Echo) Trace(path string, h interface{}, m ...interface{}) {
	e.add(TRACE, "", path, h, m...)
}