Skip to content

Commit

Permalink
refactor(grpc.go, interceptors.go, utils.go): change function name fr…
Browse files Browse the repository at this point in the history
…om setNewGRPCTraceHeaderFromContext to SetNewGRPCTraceHeaderFromContext to follow Go naming conventions and improve semantics
  • Loading branch information
shumkovdenis committed May 11, 2023
1 parent 00579c8 commit 88a5ba4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions services/integration/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (s *GRPCServer) GetBalance(
res := connect.NewResponse(&integration.GetBalanceResponse{
Balance: resBalance.Msg.Balance,
})
helpers.SetNewGRPCTraceHeaderFromContext(res.Header(), ctx)

return res, nil
}
2 changes: 1 addition & 1 deletion services/integration/helpers/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewTraceInterceptor() connect.UnaryInterceptorFunc {
) (connect.AnyResponse, error) {
if req.Spec().IsClient {
// setTraceHeaderFromContext(grpcTraceBinContextKey, req.Header(), ctx)
setNewGRPCTraceHeaderFromContext(req.Header(), ctx)
SetNewGRPCTraceHeaderFromContext(req.Header(), ctx)
} else {
ctx = WithTrace(ctx,
req.Header().Get(traceParentHeader),
Expand Down
2 changes: 1 addition & 1 deletion services/integration/helpers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func BinaryFromSpanContext(sc trace.SpanContext) []byte {
return b[:]
}

func setNewGRPCTraceHeaderFromContext(header HeaderSetter, ctx context.Context) {
func SetNewGRPCTraceHeaderFromContext(header HeaderSetter, ctx context.Context) {
value := ExtractGRPCTraceBin(ctx)
log.Println("ExtractGRPCTraceBin", value)
if value != "" {
Expand Down

0 comments on commit 88a5ba4

Please sign in to comment.