Don't store traces for Debug endpoints
This commit is contained in:
parent
c7f075d157
commit
ef537270ad
@ -2,6 +2,7 @@ package wrapper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/micro/go-micro/v2/client"
|
"github.com/micro/go-micro/v2/client"
|
||||||
"github.com/micro/go-micro/v2/debug/stats"
|
"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 func(h server.HandlerFunc) server.HandlerFunc {
|
||||||
// return a function that returns a function
|
// return a function that returns a function
|
||||||
return func(ctx context.Context, req server.Request, rsp interface{}) error {
|
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
|
// get the span
|
||||||
newCtx, s := t.Start(ctx, req.Service()+"."+req.Endpoint())
|
newCtx, s := t.Start(ctx, req.Service()+"."+req.Endpoint())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user