Skip to content

fix(csharp): report informational version in telemetry driver_version#516

Closed
eric-wang-1990 wants to merge 2 commits into
mainfrom
eric/telemetry-informational-version
Closed

fix(csharp): report informational version in telemetry driver_version#516
eric-wang-1990 wants to merge 2 commits into
mainfrom
eric/telemetry-informational-version

Conversation

@eric-wang-1990

Copy link
Copy Markdown
Collaborator

What

Telemetry's driver_version now reports the assembly's AssemblyInformationalVersion (e.g. 1.1.4-SNAPSHOT+<sha>) instead of the bare numeric AssemblyVersion (1.1.4).

Why

DatabricksConnection.InitializeTelemetry passed s_assemblyVersion into ConnectionTelemetry.Create, and s_assemblyVersion = ApacheUtility.GetAssemblyVersion(...) = Assembly.GetName().Version.ToString(3) — a purely numeric major.minor.build. That drops the -SNAPSHOT prerelease label and the +<commit-sha> build metadata, so:

  • Every 1.1.4 build (nightly, PR CI, release — each a different commit) reports an identical driver_version; you can't pinpoint which build/commit emitted an event (defeats build-cutover detection).
  • It's inconsistent with historical telemetry: production lumberjack rows show 0.23.0-SNAPSHOT+b716671<sha> (an informational version), so the field's semantics had silently regressed to the coarser numeric form.
  • It diverges from the JDBC driver's version format.
  • It's fragile: AssemblyVersion is the strong-name binding identity and is commonly pinned; if it's ever pinned for binding stability, telemetry would report a stale/wrong version.

The assembly selection was already correct (the new override reads the Databricks assembly, not the base Apache/HiveServer2 one) — only the version field was wrong.

Change

  • Add DatabricksConnection.s_telemetryDriverVersion = ApacheUtility.GetAssemblyProductVersion(typeof(DatabricksConnection), s_assemblyVersion) (the informational version, falling back to the numeric version if the attribute is absent), and feed it into ConnectionTelemetry.Create.
  • s_assemblyVersion (numeric) stays the source for the ADBC AssemblyVersion property and trace tags — unchanged.

Test

ConnectionTelemetryDriverVersionTests pins that:

  1. The telemetry version equals the assembly's AssemblyInformationalVersion.
  2. When a -SNAPSHOT/+sha suffix is present (true for all dev/CI builds via VersionSuffix=SNAPSHOT), it does not collapse to the bare numeric AssemblyVersion — the discriminating regression guard (this assertion fails on the pre-fix numeric source).

Verification

Could not build/run locally due to an unrelated net10.0 submodule vs. SDK 9.0.304 mismatch (all build errors are in hiveserver2/*, none in the changed files). CI will compile and run ConnectionTelemetryDriverVersionTests.

This pull request and its description were written by Isaac.

Telemetry's driver_version was sourced from s_assemblyVersion, i.e.
ApacheUtility.GetAssemblyVersion = Assembly.GetName().Version.ToString(3) —
a purely numeric AssemblyVersion (e.g. "1.1.4"). That drops the -SNAPSHOT
prerelease label and the +<commit-sha> build metadata, so every 1.1.4 build
(nightly, PR CI, release) reports an identical version and analysts cannot
pinpoint the build/commit. Production lumberjack data shows older builds
reporting the informational form "0.23.0-SNAPSHOT+<sha>", so the field's
semantics had silently regressed to coarser numeric values.

Feed AssemblyInformationalVersion (via the existing
ApacheUtility.GetAssemblyProductVersion) into ConnectionTelemetry.Create
through a new s_telemetryDriverVersion, falling back to the numeric version
when the attribute is absent. s_assemblyVersion stays the source for the
ADBC AssemblyVersion contract and trace tags.

Adds ConnectionTelemetryDriverVersionTests pinning that the telemetry
version equals the assembly informational version and is not the bare
numeric AssemblyVersion when a SNAPSHOT/sha suffix is present.

Co-authored-by: Isaac
string.Contains(char) does not exist on net472/netstandard2.0 (only the
string overload), which broke the Windows net472 build (CS1503). Use the
string literals "-"/"+".

Co-authored-by: Isaac
@eric-wang-1990

Copy link
Copy Markdown
Collaborator Author

Closing — not a needed fix. The current code emits a correct driver_version (e.g. 1.1.4); sourcing it from AssemblyVersion vs AssemblyInformationalVersion only differs for SNAPSHOT/dev/CI builds (1.1.4 vs 1.1.4-SNAPSHOT+<sha>), and is identical for clean releases. It's a build/commit-traceability enhancement, not a correctness bug, so closing for now. Can revisit if distinguishing SNAPSHOT/nightly builds in telemetry becomes a priority.

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.

1 participant