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

test(bqjdbc): add unit tests for OTel tracing by keshavdandeva · Pull Request #12943 · googleapis/google-cloud-java · GitHub

test(bqjdbc): add unit tests for OTel tracing - #12943

Merged
keshavdandeva merged 13 commits into
jdbc/feature-branch-otelfrom
jdbc/unit-tests-for-tracing
Apr 29, 2026
Merged

test(bqjdbc): add unit tests for OTel tracing#12943
keshavdandeva merged 13 commits into
jdbc/feature-branch-otelfrom
jdbc/unit-tests-for-tracing

Conversation

keshavdandeva commented Apr 27, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

b/491245568

Changes

Enhanced Unit Testing Infrastructure

  • OpenTelemetryTestUtility: Introduced a shared utility to simplify complex OTel assertions
  • BigQueryStatementTest: Added comprehensive parameterised tracing tests for all execution paths, including attribute validation for queries and batch operations.
  • BigQueryDatabaseMetaDataTest: Instrumented all metadata discovery methods and added corresponding unit tests to verify span generation using parameterised tests

keshavdandeva requested review from a team as code owners April 27, 2026 23:40

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 refactors BigQueryDatabaseMetaData by extracting asynchronous fetching logic for tables, columns, and schemas into dedicated methods marked @VisibleForTesting. It also updates OpenTelemetry tracing across BigQueryDatabaseMetaData and BigQueryStatement to ensure better context propagation and adds comprehensive unit tests to verify span generation. The review feedback highlights an inconsistency in the parameters passed to the refactored runGetTablesTaskAsync method and suggests improving the robustness of new tests by avoiding the capture of NullPointerException and using more specific assertions for verifying trace context links.

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 adds the opentelemetry-sdk-testing dependency and refactors BigQueryDatabaseMetaData to extract background task logic into testable methods, while enhancing OpenTelemetry tracing in both BigQueryDatabaseMetaData and BigQueryStatement. New tests are added to verify span generation and linking. The reviewer identified a missing method runNextPageTaskAsync in BigQueryStatement that will cause compilation errors and recommended using bounded thread pools for background tasks. Additionally, it is suggested to mock dependencies in tests rather than catching NullPointerException to verify span generation more reliably.

Copy link
Copy Markdown
Contributor

Please use bqjdbc in the title, so it will be easier to find PRs in the future (e.g. spanner has their own jdbc in that repo)

keshavdandeva changed the title test(jdbc): add unit tests for OTel tracing test(bqjdbc): add unit tests for OTel tracing Apr 28, 2026
Base automatically changed from jdbc/add-otel-to-metadata to jdbc/feature-branch-otel April 28, 2026 13:31

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 introduces OpenTelemetry testing support and refactors BigQueryDatabaseMetaData and BigQueryStatement to enhance observability and testability. Key changes include extracting background task logic into testable methods and adding comprehensive unit tests to verify span generation and linking. The review feedback suggests a minor optimization in BigQueryStatement to cache the tracer instance instead of repeatedly fetching it within a pagination loop.

keshavdandeva requested a review from logachev April 28, 2026 16:43
keshavdandeva merged commit 20bb4f9 into jdbc/feature-branch-otel Apr 29, 2026
96 checks passed
keshavdandeva deleted the jdbc/unit-tests-for-tracing branch April 29, 2026 09:59
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