feat(gax): emit T4 attempt spans - #9496
shivanee-p wants to merge 13 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements OpenTelemetry trace context propagation into gRPC and HTTP/REST metadata within the gax package, introducing an isMetadata utility and a comprehensive test suite. The review feedback points out that plain object metadata should be cloned before injecting the active span context to prevent unintended mutations and trace context leakage.
c711b36 to
4bdc143
Compare
…er and createApiCall
…ntation libraries
7e54208 to
396dcd0
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces Tier 4 (T4) per-attempt tracing spans (OpenTelemetry CLIENT spans) parented under the T3 client request spans in google-gax. It adds traceAttempt in TracerHelper.ts to manage individual RPC transport attempts, captures service path and port configurations in both gRPC and fallback clients, and updates unit tests to verify the new span relationships and attributes. Feedback on the changes highlights a critical issue in createApiCall.ts where mutating the outer func parameter inside invokeCall causes a memory leak and call stack growth across multiple API calls; a fix is suggested to wrap currentApiCaller instead.
Emits OpenTelemetry tracing spans per-attempt transport spans (
SpanKind.CLIENT) directly fromgoogle-gaxfor both gRPC and HTTP/REST fallback callsKey Changes:
traceAttempt()andAttemptTraceContextto wrap each individual transport attempt (<apiName>/<methodName>,SpanKind.CLIENT), parented to the enclosing T3 client call span (<ClientName>.<MethodName>,SpanKind.INTERNAL)gcp.client.service/rpc.system,rpc.method/http.request.method,url.domain,server.address,server.port,gcp.grpc.resend_count/http.request.resend_count,error.type, span error status, andexceptionevents on attempt failuresservicePath/apiEndpointandportfromGrpcClientoptions intoconstructSettingsotherArgsso static trace context resolves custom endpoints and portstraceAttempt, T3/T4 parent-child hierarchies across unary, retries, and streaming calls, HTTP verb resolution, and transport-specific status code attributes