Skip to content

feat(bigquery-jdbc): implement driver environment builder#13723

Open
Neenu1995 wants to merge 3 commits into
jdbc-telemetry-featurefrom
jdbc-telemetry-pr4
Open

feat(bigquery-jdbc): implement driver environment builder#13723
Neenu1995 wants to merge 3 commits into
jdbc-telemetry-featurefrom
jdbc-telemetry-pr4

Conversation

@Neenu1995

@Neenu1995 Neenu1995 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

b/527947900

This is PR4 of multi-part telemetry client implementation. This PR implements DriverEnvironmentBuilder and its corresponding unit tests (DriverEnvironmentBuilderTest) as part of the BigQuery JDBC telemetry client infrastructure.

It provides a package-private utility for constructing DriverEnvironment protocol buffer payloads by inspecting client runtime properties and managing a persistent installation-scoped UUID.

Key Changes

  • Environment Detection:
    • Extracts major Java version (supporting both legacy 1.8.x and modern 11+/17+ formats).
    • Maps OS names to standard DriverEnvironment.OsType enums (Windows, macOS/Darwin, Linux, Solaris, BSDs, AIX).
    • Extracts major OS version and sanitizes driver version strings (to major.minor).
  • Telemetry Tag Management:
    • Manages a persistent UUID in ~/.bigquery-jdbc/telemetry-tag.
    • Includes defensive fallback logic: handles missing user.home (serverless/container runtimes), read-only file systems, SecurityExceptions, and automatically overwrites corrupted/invalid file contents with a fresh UUID.

@Neenu1995 Neenu1995 requested review from a team as code owners July 9, 2026 17:56

@gemini-code-assist 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.

Code Review

This pull request introduces telemetry capabilities to the BigQuery JDBC driver, adding protobuf definitions, build configurations, environment builders, and configuration settings along with their respective unit tests. The review feedback highlights two important improvements in DriverEnvironmentBuilder: making the getOrCreateTelemetryTag method thread-safe to prevent race conditions in concurrent environments, and validating that the telemetry tag path is a regular file of a reasonable size before reading to avoid potential exceptions or memory issues.

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