FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(bqjdbc): Complete OpenTelemetry instrumentation and context propagation by keshavdandeva · Pull Request #13187 · googleapis/google-cloud-java · GitHub

feat(bqjdbc): Complete OpenTelemetry instrumentation and context propagation - #13187

Merged
keshavdandeva merged 5 commits into
jdbc/feature-branch-otelfrom
jdbc/complete-otel-intrumentation
May 19, 2026
Merged

feat(bqjdbc): Complete OpenTelemetry instrumentation and context propagation#13187
keshavdandeva merged 5 commits into
jdbc/feature-branch-otelfrom
jdbc/complete-otel-intrumentation

Conversation

Copy link
Copy Markdown
Contributor

b/496720140

Changes

Context Propagation & Session Tracking

  • Baggage Injection: Injected the generated Connection UUID into OpenTelemetry Baggage upon BigQueryConnection initialization to enable reliable log correlation.
  • Log Handler Update: Updated OpenTelemetryJulHandler to rely on Baggage for retrieving the connection ID, removing the legacy MDC fallback.
  • Thread Pool Audit: Wrapped tasks submitted to background executors in BigQueryDatabaseMetaData with Context.current().wrap(), ensuring trace context is not lost during parallel metadata fetching.

Span Enrichment & Semantic Conventions

  • Attributes: Enriched JDBC spans with standard attributes: db.system = "bigquery", db.connection_id, and db.application (derived from partnerToken or falling back to "Google-BigQuery-JDBC-Driver").
  • Scope Separation: Implemented separate tracers for the JDBC driver (com.google.cloud.bigquery.jdbc) and the SDK (com.google.cloud.bigquery) to allow clean filtering in tracing UIs while maintaining correlation.

Instrumentation

  • PreparedStatement: Added missing instrumentation for BigQueryPreparedStatement execution methods (execute, executeQuery, executeLargeUpdate) to generate spans.

Refactoring & Cleanups

  • Centralized Tracing: Created a centralized withTracing helper in BigQueryJdbcOpenTelemetry.java to eliminate duplicated tracing logic in BigQueryStatement and BigQueryDatabaseMetaData.
  • Constants: Defined all semantic convention keys as constants in BigQueryJdbcOpenTelemetry.java to eliminate magic strings from method bodies.
  • Simplifications: Simplified redundant boolean checks in BigQueryConnection.java.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request centralizes OpenTelemetry tracing logic within the BigQuery JDBC driver by introducing a static withTracing utility in BigQueryJdbcOpenTelemetry. It standardizes span attribute tagging for database operations and ensures OpenTelemetry context is propagated across asynchronous tasks in BigQueryDatabaseMetaData. Review feedback highlights a potential issue with trace continuity when using connection-level context as a parent instead of the current request context, and suggests improvements to exception handling to prevent unnecessary nesting and ensure InterruptedException is not swallowed.

Copy link
Copy Markdown
Contributor Author

/gemini review

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request centralizes OpenTelemetry tracing logic by introducing a standard withTracing utility in BigQueryJdbcOpenTelemetry, which is now used across BigQueryStatement, BigQueryPreparedStatement, and BigQueryDatabaseMetaData to record consistent database attributes. The changes also improve context propagation for asynchronous tasks, add connection state checks, and simplify baggage handling by removing redundant MDC fallbacks. Feedback suggests optimizing the withTracing method by retrieving the connection ID directly from the connection object rather than from the OpenTelemetry context baggage.

Copy link
Copy Markdown
Contributor Author

/gemini review

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request centralizes OpenTelemetry tracing by introducing a standard withTracing utility in BigQueryJdbcOpenTelemetry, which is now used across statements and metadata operations to ensure consistent attribute population and error handling. The changes also improve context propagation for asynchronous tasks and transition connection ID tracking to OpenTelemetry baggage. Feedback from the review highlights a potential NullPointerException due to boolean unboxing, suggests explicitly setting the span kind to CLIENT for database calls, and provides recommendations for handling InterruptedException.

keshavdandeva marked this pull request as ready for review May 14, 2026 14:50
keshavdandeva requested review from a team as code owners May 14, 2026 14:50
keshavdandeva merged commit 27ed8de into jdbc/feature-branch-otel May 19, 2026
127 of 130 checks passed
keshavdandeva deleted the jdbc/complete-otel-intrumentation branch May 19, 2026 12:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL