Skip to content

feat: add o11y gRPC tracing - #9267

Open
shivanee-p wants to merge 10 commits into
shivaneep-o11y-tracer-helper-updatesfrom
shivaneep-o11y-grpc-tracing
Open

feat: add o11y gRPC tracing#9267
shivanee-p wants to merge 10 commits into
shivaneep-o11y-tracer-helper-updatesfrom
shivaneep-o11y-grpc-tracing

Conversation

@shivanee-p

@shivanee-p shivanee-p commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Call TracerHelper within createApiCall() and update unit tests accordingly

  • build StaticTraceContext from the internal telemetry information from CallSettings
  • determine if calls are streaming or not
  • add unit tests for fallback detection

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates OpenTelemetry tracing into API calls within google-gax. It updates createApiCall to wrap invocations with traceAttempt when telemetry is enabled, captures static and dynamic trace contexts, and propagates the internal method name via constructSettings. Additionally, traceAttempt is refactored to synchronously handle both synchronous results and Promises. The feedback highlights two important issues: first, checking result instanceof Promise is fragile and fails to correctly track the lifetime of streaming calls (which return streams rather than Promises); second, the unit tests use a synchronous callback mock that masks this premature span termination. It is recommended to check for thenables and streams to properly manage span lifetimes, and to update the tests to invoke callbacks asynchronously.

Comment thread core/packages/gax/src/observability/TracerHelper.ts Outdated
Comment thread core/packages/gax/test/unit/apiCallable.ts
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch 2 times, most recently from fa84a3f to 0706fc7 Compare September 8, 2026 23:31
@shivanee-p
shivanee-p changed the base branch from main to shivaneep-o11y-tracer-helper-updates September 8, 2026 23:33
@shivanee-p shivanee-p changed the title Shivaneep o11y grpc tracing feat: add o11y gRPC tracing Sep 8, 2026
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch 2 times, most recently from d231ce3 to 6ae7e02 Compare September 8, 2026 23:53
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch from 6ae7e02 to 57d1e9a Compare September 9, 2026 00:03
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch 4 times, most recently from 6ed7d57 to 98c43f2 Compare September 9, 2026 00:39
@shivanee-p
shivanee-p removed this pull request from stack #9270 September 9, 2026 15:29
@shivanee-p
shivanee-p added this pull request to stack #9275 September 9, 2026 15:29
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch from 98c43f2 to 5691da9 Compare September 9, 2026 15:34
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch 2 times, most recently from add101e to d7b3c8e Compare September 9, 2026 20:59
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch 2 times, most recently from 16cfa1e to 4a51201 Compare September 9, 2026 21:23
@shivanee-p
shivanee-p marked this pull request as ready for review September 9, 2026 21:30
@shivanee-p
shivanee-p requested a review from a team as a code owner September 9, 2026 21:30
@shivanee-p

Copy link
Copy Markdown
Contributor Author

/gemini review

@github-actions
github-actions Bot requested a review from bshaffer September 9, 2026 21:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates OpenTelemetry tracing into the API call creation process by wrapping invocations with traceAttempt when tracing is enabled, and adds comprehensive unit tests to validate tracing behavior across different call types. The review feedback points out a potential TypeError in createApiCall.ts where properties are accessed on internalTelemetryInfo without optional chaining, which could throw an error if the telemetry info is undefined.

Comment thread core/packages/gax/src/createApiCall.ts Outdated
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch from 4513369 to 2f47ead Compare September 10, 2026 01:46
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch from 2f47ead to f54aaa4 Compare September 10, 2026 18:37
@shivanee-p
shivanee-p removed this pull request from stack #9275 September 10, 2026 18:41
@shivanee-p
shivanee-p added this pull request to stack #9282 September 10, 2026 18:42
@shivanee-p
shivanee-p force-pushed the shivaneep-o11y-grpc-tracing branch from c428d77 to 9ded6a0 Compare September 11, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant