Skip to content

Forward kernel telemetry options - #506

Open
jay-xiao446 wants to merge 1 commit into
mainfrom
jay/forward-kernel-telemetry-options
Open

Forward kernel telemetry options#506
jay-xiao446 wants to merge 1 commit into
mainfrom
jay/forward-kernel-telemetry-options

Conversation

@jay-xiao446

Copy link
Copy Markdown
Collaborator

Summary

  • forward driver/runtime identity and telemetry config into kernel openSession options
  • disable Node-wrapper telemetry on useKernel connections to avoid duplicate telemetry
  • preserve DATABRICKS_TELEMETRY_DISABLED as a hard opt-out for kernel-owned telemetry

Tests

  • npx tsc --project tsconfig.build.json --noEmit
  • npx mocha --config tests/unit/.mocharc.js tests/unit/kernel/execution.test.ts tests/unit/DBSQLClient.test.ts

Notes:

  • npx tsc --noEmit still fails on existing token federation example imports of @databricks/sql before package build artifacts exist.
  • eslint on the touched test specs is blocked by existing test-file lint debt; touched lib files produced no lint errors.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Medium · 1 Low

Clean, well-tested forwarding of telemetry/runtime identity into the kernel path, and the wrapper-telemetry suppression on useKernel is correct. One medium: getLocaleName uses inverted POSIX locale precedence (checks LANG before LC_ALL/LC_MESSAGES), so overrides are ignored. One low: duplicated env-disable parsing that could drift from DBSQLClient.

Comment thread lib/kernel/KernelAuth.ts
if (scriptPath) {
return sanitizeProcessName(scriptPath).replace(/\.[^.]*$/, '') || 'node';
}
return 'node';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium — Locale env precedence is inverted. POSIX resolution order is LC_ALL (overrides everything) → the specific category (LC_MESSAGES) → LANG (fallback default). Here the fallback (LANG) is checked first:

const lang = env.LANG || env.LC_ALL || env.LC_MESSAGES || '';

Because LANG is set in almost every environment, an LC_ALL/LC_MESSAGES override is silently ignored and the reported localeName will be wrong for any user who overrides the category vars on top of a base LANG. Reorder to env.LC_ALL || env.LC_MESSAGES || env.LANG || '' to match POSIX. This only affects telemetry metadata (not query behavior), hence medium, and the new test (localeName just .to.be.a('string')) does not exercise precedence.

Comment thread lib/kernel/KernelAuth.ts
osVersion: os.release(),
osArch: os.arch(),
clientAppName: undefined,
localeName: getLocaleName(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Low — isTelemetryDisabledByEnv re-implements the exact DATABRICKS_TELEMETRY_DISABLED parsing that already lives in DBSQLClient.ts (trim + /^(1|true|yes|on)$/i). The two copies can drift — e.g. if one later accepts enabled/0 or a different truthy set, the wrapper opt-out and the kernel opt-out would disagree, which is exactly the invariant this PR is trying to preserve. Consider extracting a single shared helper and having both call sites use it.

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