Exemplo n.º 1
0
func (s *Server) onError(err error) {
	// TODO(prashant): Expose incoming call errors through options for NewServer.
	// Timeouts should not be reported as errors.
	if tchannel.GetSystemErrorCode(err) == tchannel.ErrCodeTimeout {
		s.log.Debugf("thrift Server timeout: %v", err)
	} else {
		s.log.WithFields(tchannel.ErrField(err)).Error("Thrift server error.")
	}
}
Exemplo n.º 2
0
// NewTCollectorReporter return trace reporter that submits span to TCollector.
func NewTCollectorReporter(ch *tc.Channel) *TCollectorReporter {
	thriftClient := thrift.NewClient(ch, tcollectorServiceName, nil)
	client := tcollector.NewTChanTCollectorClient(thriftClient)

	curHostIP, err := tc.ListenIP()
	if err != nil {
		ch.Logger().WithFields(tc.ErrField(err)).Warn("TCollector TraceReporter failed to get IP.")
		curHostIP = net.IPv4(0, 0, 0, 0)
	}

	// create the goroutine method to actually to the submit Span.
	reporter := &TCollectorReporter{
		tchannel:  ch,
		client:    client,
		c:         make(chan tc.TraceData, chanBufferSize),
		logger:    ch.Logger(),
		curHostIP: inetAton(curHostIP.String()),
	}
	go reporter.worker()
	return reporter
}