Skip to content

Commit

Permalink
otelgrpc: Remove code that has no effects in stats handlers (#4773)
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared authored Jan 4, 2024
1 parent f770d88 commit f16553c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type serverHandler struct {
*config
}

// NewServerHandler creates a stats.Handler for gRPC server.
// NewServerHandler creates a stats.Handler for a gRPC server.
func NewServerHandler(opts ...Option) stats.Handler {
h := &serverHandler{
config: newConfig(opts, "server"),
Expand All @@ -54,9 +54,6 @@ func NewServerHandler(opts ...Option) stats.Handler {

// TagConn can attach some information to the given context.
func (h *serverHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context {
span := trace.SpanFromContext(ctx)
attrs := peerAttr(peerFromCtx(ctx))
span.SetAttributes(attrs...)
return ctx
}

Expand Down Expand Up @@ -93,7 +90,7 @@ type clientHandler struct {
*config
}

// NewClientHandler creates a stats.Handler for gRPC client.
// NewClientHandler creates a stats.Handler for a gRPC client.
func NewClientHandler(opts ...Option) stats.Handler {
h := &clientHandler{
config: newConfig(opts, "client"),
Expand Down Expand Up @@ -127,10 +124,7 @@ func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
}

// TagConn can attach some information to the given context.
func (h *clientHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context {
span := trace.SpanFromContext(ctx)
attrs := peerAttr(cti.RemoteAddr.String())
span.SetAttributes(attrs...)
func (h *clientHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context {
return ctx
}

Expand Down

0 comments on commit f16553c

Please sign in to comment.