fix(middleware/tracing): golang filename modify (#2727)

pull/2612/head
jessetang 2 years ago committed by GitHub
parent d470886977
commit f03f5f8988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      middleware/tracing/statshandler.go
  2. 14
      middleware/tracing/statshandler_test.go

@ -31,9 +31,9 @@ func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
if !ok { if !ok {
return return
} }
remoteAddr := p.Addr.String() span := trace.SpanFromContext(ctx)
if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() { if span.SpanContext().IsValid() {
span.SetAttributes(peerAttr(remoteAddr)...) span.SetAttributes(peerAttr(p.Addr.String())...)
} }
} }

@ -18,7 +18,7 @@ func TestClient_HandleConn(_ *testing.T) {
(&ClientHandler{}).HandleConn(context.Background(), nil) (&ClientHandler{}).HandleConn(context.Background(), nil)
} }
func Test_Client_TagConn(t *testing.T) { func TestClient_TagConn(t *testing.T) {
client := &ClientHandler{} client := &ClientHandler{}
ctx := context.WithValue(context.Background(), testKey, 123) ctx := context.WithValue(context.Background(), testKey, 123)
@ -27,7 +27,7 @@ func Test_Client_TagConn(t *testing.T) {
} }
} }
func Test_Client_TagRPC(t *testing.T) { func TestClient_TagRPC(t *testing.T) {
client := &ClientHandler{} client := &ClientHandler{}
ctx := context.WithValue(context.Background(), testKey, 123) ctx := context.WithValue(context.Background(), testKey, 123)
@ -36,12 +36,10 @@ func Test_Client_TagRPC(t *testing.T) {
} }
} }
type ( type mockSpan struct {
mockSpan struct { trace.Span
trace.Span mockSpanCtx *trace.SpanContext
mockSpanCtx *trace.SpanContext }
}
)
func (m *mockSpan) SpanContext() trace.SpanContext { func (m *mockSpan) SpanContext() trace.SpanContext {
return *m.mockSpanCtx return *m.mockSpanCtx
Loading…
Cancel
Save