GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@chalmerlowe chalmerlowe commented Nov 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
All reactions
  • 👀 1 reaction
@chalmerlowe
feat(api_core): implement L2/L3 method error logging and L4 transport…
9535146
… attempt logging
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 5, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

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.

All reactions
Comment thread packages/google-api-core/google/api_core/_observability.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-api-core/google/api_core/_observability.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/google-api-core/google/api_core/_observability.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@chalmerlowe
fix(api_core): normalize enum status codes and fail-open gRPC post-di…
44b088c
…spatch inspection
chalmerlowe
chalmerlowe commented Nov 5, 2026
View reviewed changes
Comment thread packages/google-api-core/google/api_core/gapic_v1/method.py


def _extract_rpc_identity(
method_name: str,

@chalmerlowe chalmerlowe Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

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.

All reactions
chalmerlowe added 8 commits November 5, 2026 17:03
@chalmerlowe
refactor(api-core): tighten type annotations and unify PEP 604 syntax
55449b0
@chalmerlowe
refactor(api-core): simplify guards and document fail-open exception …
2672735
…handlers
@chalmerlowe
refactor(api-core): deduplicate rpc_system, tracer_provider, and inte…
e0597ae
…rceptor method lookups
@chalmerlowe
refactor(api-core): replace method_str with method_name and full_rpc_…
15599be
…name
@chalmerlowe
refactor(api-core): simplify gRPC attempt logging interceptors and or…
fad4d96
…der before suppression
@chalmerlowe
refactor(api-core): consolidate module-level constants at top of files
ceeffc1
@chalmerlowe
refactor(api-core): extract _extract_http_status_code and simplify in…
ca2e2d3
…terceptor sandwiching
@chalmerlowe
fix(api_core): defer gRPC attempt logging to done callbacks and refin…
7eb7a87
…e tests
@chalmerlowe

chalmerlowe commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of the 5-part stacked PR series for M3 error logging:

  1. refactor(api_core): centralize RPC identity and HTTP status helpers in _observability #19008 (refactor/otel-logging-m3-s1-types-identity)
  2. feat(api_core): add error logging feature gate and shared transport attempt logging helpers #19009 (feat/otel-logging-m3-s2-logging-helpers)
  3. feat(api_core): add sync and async gRPC transport attempt logging interceptors #19010 (feat/otel-logging-m3-s3-grpc-attempt-logging)
  4. feat(api_core): add HTTP transport attempt logging in _TraceContext #19011 (feat/otel-logging-m3-s4-http-attempt-logging)
  5. feat(api_core): add method-level terminal error logging in _GapicCallable #19012 (feat/otel-logging-m3-s5-method-error-logging)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chalmerlowe chalmerlowe closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

1 participant

@chalmerlowe
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.