Update the Debug Handler to use the servers tracer
This commit is contained in:
		| @@ -12,10 +12,14 @@ import ( | |||||||
| 	"github.com/micro/go-micro/server" | 	"github.com/micro/go-micro/server" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | // NewHandler returns an instance of the Debug Handler | ||||||
| 	// DefaultHandler is default debug handler | func NewHandler(srv server.Server) *Debug { | ||||||
| 	DefaultHandler = newDebug() | 	return &Debug{ | ||||||
| ) | 		log:   log.DefaultLog, | ||||||
|  | 		stats: stats.DefaultStats, | ||||||
|  | 		trace: srv.Options().Tracer, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| type Debug struct { | type Debug struct { | ||||||
| 	// must honour the debug handler | 	// must honour the debug handler | ||||||
| @@ -28,14 +32,6 @@ type Debug struct { | |||||||
| 	trace trace.Tracer | 	trace trace.Tracer | ||||||
| } | } | ||||||
|  |  | ||||||
| func newDebug() *Debug { |  | ||||||
| 	return &Debug{ |  | ||||||
| 		log:   log.DefaultLog, |  | ||||||
| 		stats: stats.DefaultStats, |  | ||||||
| 		trace: trace.DefaultTracer, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (d *Debug) Health(ctx context.Context, req *proto.HealthRequest, rsp *proto.HealthResponse) error { | func (d *Debug) Health(ctx context.Context, req *proto.HealthRequest, rsp *proto.HealthResponse) error { | ||||||
| 	rsp.Status = "ok" | 	rsp.Status = "ok" | ||||||
| 	return nil | 	return nil | ||||||
|   | |||||||
| @@ -158,7 +158,7 @@ func (s *service) Run() error { | |||||||
| 	// register the debug handler | 	// register the debug handler | ||||||
| 	s.opts.Server.Handle( | 	s.opts.Server.Handle( | ||||||
| 		s.opts.Server.NewHandler( | 		s.opts.Server.NewHandler( | ||||||
| 			handler.DefaultHandler, | 			handler.NewHandler(s.Options().Server), | ||||||
| 			server.InternalHandler(true), | 			server.InternalHandler(true), | ||||||
| 		), | 		), | ||||||
| 	) | 	) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user