Skip to content

Commit

Permalink
fix for comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
  • Loading branch information
fatsheep9146 committed Mar 20, 2023
1 parent d8da923 commit c992fdb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"go.opentelemetry.io/otel/trace"
)

type grpcContext struct {
type gRPCContext struct {
messagesReceived int64
messagesSent int64
}
Expand Down Expand Up @@ -66,8 +66,8 @@ func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
trace.WithAttributes(attrs...),
)

gctx := grpcContext{}
return context.WithValue(ctx, grpcContext{}, &gctx)
gctx := gRPCContext{}
return context.WithValue(ctx, gRPCContext{}, &gctx)
}

// HandleRPC processes the RPC stats.
Expand All @@ -87,7 +87,7 @@ func (h *serverHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) co
func (h *serverHandler) HandleConn(ctx context.Context, info stats.ConnStats) {
}

// NewClientHandler create a stats.Handler for grpc client.
// NewClientHandler creates a stats.Handler for gRPC client.
func NewClientHandler(opts ...Option) stats.Handler {
h := &clientHandler{
config: newConfig(opts),
Expand Down Expand Up @@ -118,9 +118,9 @@ func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) cont
trace.WithAttributes(attrs...),
)

gctx := grpcContext{}
gctx := gRPCContext{}

return inject(context.WithValue(ctx, grpcContext{}, &gctx), h.config.Propagators)
return inject(context.WithValue(ctx, gRPCContext{}, &gctx), h.config.Propagators)
}

// HandleRPC processes the RPC stats.
Expand All @@ -143,7 +143,7 @@ func (h *clientHandler) HandleConn(context.Context, stats.ConnStats) {

func handleRPC(ctx context.Context, rs stats.RPCStats) {
span := trace.SpanFromContext(ctx)
gctx, _ := ctx.Value(grpcContext{}).(*grpcContext)
gctx, _ := ctx.Value(gRPCContext{}).(*gRPCContext)
var messageId int64

switch rs := rs.(type) {
Expand Down

0 comments on commit c992fdb

Please sign in to comment.