Don't store traces for Debug endpoints

This commit is contained in:
Asim Aslam 2020-02-07 20:58:03 +00:00
parent c7f075d157
commit ef537270ad

View File

@ -2,6 +2,7 @@ package wrapper
import (
"context"
"strings"
"github.com/micro/go-micro/v2/client"
"github.com/micro/go-micro/v2/debug/stats"
@ -111,6 +112,11 @@ func TraceHandler(t trace.Tracer) server.HandlerWrapper {
return func(h server.HandlerFunc) server.HandlerFunc {
// return a function that returns a function
return func(ctx context.Context, req server.Request, rsp interface{}) error {
// don't store traces for debug
if strings.HasPrefix(req.Endpoint(), "Debug.") {
return h(ctx, req, rsp)
}
// get the span
newCtx, s := t.Start(ctx, req.Service()+"."+req.Endpoint())