GeezerVison is showing github.com — feat(api_core): implement L2/L3 method error logging and L4 transport attempt logging by chalmerlowe · Pull Request #19000 · googleapis/google-cloud-python
Conversation
chalmerlowe
commented
Nov 5, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Implements OpenTelemetry-correlated Production Error Logging (PEL) across GAPIC method calls (Tier 3 / L3) and underlying gRPC and HTTP transport wire attempts (Tier 4 / L4) in google-api-core:
- Feature Gating (
client_logging.is_error_logging_enabled): Gates Production Error Logging via GOOGLE_SDK_EXPERIMENTAL_PYTHON_LOGGING_ENABLED and client_options.logger_provider, keeping it distinct from Application Payload Debug Logging (GOOGLE_SDK_PYTHON_LOGGING_SCOPE).
- Tier 3 Method-Layer Error & Cancellation Telemetry (
gapic_v1/method.py): Enriches active Tier 3 spans with structured error attributes and emits a single terminal ERROR log record on RPC failure (or a DEBUG log record without traceback on cancellation) across sync and async calls.
- Tier 4 Transport-Attempt Debug Logging (
_observability.py): Emits DEBUG log records for failed/retried gRPC and HTTP wire attempts (log_transport_attempt, _GrpcAttemptLoggingInterceptor, _AsyncGrpcAttemptLoggingInterceptor, and _TraceContext) while remaining a zero-allocation no-op on successful 2xx / OK attempts.
Bug: b/479827845
Verification: Relying on GitHub Actions CI for full matrix verification.
Stacked on #18893.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
gemini-code-assist[bot] reacted with eyes emoji
There was a problem hiding this comment.
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 introduces OpenTelemetry-correlated Production Error Logging (PEL) for both gRPC and HTTP transports across synchronous and asynchronous clients, including new interceptors, feature gating, and terminal RPC error logging. The review feedback highlights three critical issues in _observability.py that could compromise the library's fail-open design: first, calling response.exception() on a cancelled gRPC future in the synchronous interceptor may raise an unhandled CancelledError and crash the application; second, converting grpc.StatusCode enums directly to strings using str() yields incorrect status names (e.g., 'StatusCode.OK'), breaking failure detection; and third, executing post-dispatch logging inside the exception-capturing context manager in the asynchronous interceptor could allow logging failures to disrupt the main RPC flow.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
|
|
|
def _extract_rpc_identity(
|
|
|
method_name: str,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
To the reviewer: this has been moved to _observability.py
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.