8000 rpc: tracing interceptors in drpc · Issue #144372 · cockroachdb/cockroach · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
rpc: tracing interceptors in drpc #144372
@shaikzakiriitm

Description

@shaikzakiriitm

DRPC implementation of tracing interceptors
This issue is part of a goal to implement all the grpc interceptors within drpc.
This issue tracks implementation of client interceptors based on tracer, tagger in drpc.
Code references:

if tracer := rpcCtx.Stopper.Tracer(); tracer != nil {
// We use a decorator to set the "node" tag. All other spans get the
// node tag from context log tags.
//
// Unfortunately we cannot use the corresponding interceptor on the
// server-side of gRPC to set this tag on server spans because that
// interceptor runs too late - after a traced RPC's recording had
// already been collected. So, on the server-side, the equivalent code
// is in setupSpanForIncomingRPC().
//
tagger := func(span *tracing.Span) {
span.SetTag("node", attribute.IntValue(int(rpcCtx.NodeID.Get())))
}
if rpcCtx.ClientOnly {
// client-only RPC contexts don't have a node ID to report nor a
// cluster version to check against.
tagger = func(span *tracing.Span) {}
}
rpcCtx.clientUnaryInterceptors = append(rpcCtx.clientUnaryInterceptors,
grpcinterceptor.ClientInterceptor(tracer, tagger))
rpcCtx.clientStreamInterceptors = append(rpcCtx.clientStreamInterceptors,
grpcinterceptor.StreamClientInterceptor(tracer, tagger))
}

Jira issue: CRDB-49356

Metadata

Metadata

Labels

C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-db-server

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0