Skip to content

Commit

Permalink
chore: use enableGRPCMetadata
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <[email protected]>
  • Loading branch information
rogerogers committed Oct 10, 2024
1 parent 6222294 commit 80c9213
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tracing/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func ClientMiddleware(cfg *config) endpoint.Middleware {

Inject(ctx, cfg, md)

if cfg.enableMetadata {
if cfg.enableGRPCMetadata {
grpcMd, ok := metadata.FromOutgoingContext(ctx)
if ok {
ctx = injectMetadata(ctx, cfg, grpcMd)
Expand Down Expand Up @@ -82,7 +82,7 @@ func ServerMiddleware(cfg *config) endpoint.Middleware {
md := metainfo.GetAllValues(ctx)
peerServiceAttributes := extractPeerServiceAttributesFromMetaInfo(md)

if cfg.enableMetadata {
if cfg.enableGRPCMetadata {
grpcMd, ok := metadata.FromIncomingContext(ctx)
if ok {
ctx = extractMetadata(ctx, cfg, grpcMd)
Expand Down
8 changes: 4 additions & 4 deletions tracing/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type config struct {
textMapPropagator propagation.TextMapPropagator

recordSourceOperation bool
enableMetadata bool
enableGRPCMetadata bool
}

func newConfig(opts []Option) *config {
Expand Down Expand Up @@ -90,9 +90,9 @@ func WithTextMapPropagator(p propagation.TextMapPropagator) Option {
})
}

// WithEnableMetadata Enable retrieving data from metadata or adding data to metadata
func WithEnableMetadata() Option {
// WithEnableGRPCMetadata Enable retrieving data from metadata or adding data to metadata
func WithEnableGRPCMetadata() Option {
return option(func(cfg *config) {
cfg.enableMetadata = true
cfg.enableGRPCMetadata = true
})
}

0 comments on commit 80c9213

Please sign in to comment.