Skip to content

feat(bqjdbc): Implement Correlated OpenTelemetry Logging Bridge#13002

Merged
keshavdandeva merged 11 commits intojdbc/feature-branch-otelfrom
jdbc/otel-jul-handler
May 7, 2026
Merged

feat(bqjdbc): Implement Correlated OpenTelemetry Logging Bridge#13002
keshavdandeva merged 11 commits intojdbc/feature-branch-otelfrom
jdbc/otel-jul-handler

Conversation

@keshavdandeva
Copy link
Copy Markdown
Contributor

b/496678357

This PR implements the Correlated GCP Logging Bridge for the OpenTelemetry integration in the BigQuery JDBC driver. It enables bridging standard Java logs (java.util.logging) to the OpenTelemetry Logs API, allowing users to correlate logs with distributed traces and isolate them by connection session.

Changes

  • BigQueryDriver.java: Implemented Cloud-Only Mode matrix logic to suppress local file creation when enableGcpLogExporter=true and LogPath is omitted.
  • BigQueryJdbcRootLogger.java: Updated setLevel to handle Level.OFF properly and skip file handler creation if path is null.
  • BigQueryConnection.java: Attached OpenTelemetryJulHandler to the "com.google.cloud.bigquery" namespace during initialization.
  • OpenTelemetryJulHandler.java: Created a new handler that bridges JUL logs to OTel Logs API with context harvesting and connection ID filtering.
  • pom.xml: Added google-cloud-logging dependency with version 3.33.0-SNAPSHOT and auto-update marker.
  • OpenTelemetryJulHandlerTest.java: Created unit tests using OpenTelemetryExtension to verify log emission and filtering.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 and Google Cloud Logging support for the BigQuery JDBC driver, including a new OpenTelemetryJulHandler to bridge logs and logic to suppress local logging in cloud-only mode. The review identified several critical issues regarding resource management and logging correctness: a significant handler leak occurs because new handlers are attached to a shared logger instance for every connection without being removed, the handler incorrectly logs raw message templates instead of formatted strings, and the root logger fails to clean up existing file handlers when switching to cloud-only logging.

@keshavdandeva
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 implements a logging bridge from java.util.logging to OpenTelemetry and Google Cloud Logging, including a new OpenTelemetryJulHandler and connection-specific telemetry management. Key feedback focuses on making the handler registration idempotent to avoid duplicates, ensuring global logs are not silently dropped when connection IDs are absent, and correctly formatting trace IDs for GCP correlation. Further improvements were suggested regarding exception safety during client flushing and clarifying parameter naming in the telemetry configuration logic.

@keshavdandeva keshavdandeva marked this pull request as ready for review May 6, 2026 01:49
@keshavdandeva keshavdandeva requested review from a team as code owners May 6, 2026 01:49
@keshavdandeva keshavdandeva requested a review from logachev May 6, 2026 12:58
@keshavdandeva keshavdandeva merged commit 1adc224 into jdbc/feature-branch-otel May 7, 2026
100 of 104 checks passed
@keshavdandeva keshavdandeva deleted the jdbc/otel-jul-handler branch May 7, 2026 16:50
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.

2 participants