…atabricks#417)
* [SEA-NodeJS] Unify kernel + driver logging into one DBSQLLogger sink
The Rust kernel emits its diagnostics via `tracing`; in a Node process nothing
subscribed to them, so kernel logs were silently dropped — the `DBSQLLogger`
only ever saw driver-side lines. This wires the kernel into the SAME logger (and
file) the driver uses, so logs from all three layers — driver, napi shim,
kernel — land in one place.
How:
- `SeaBackend.connect()` calls `installKernelLogBridge(binding, logger, level)`
(new `lib/sea/SeaLogging.ts`), which registers a JS callback with the binding's
`initKernelLogging`. The callback maps each kernel `LogRecord`
(`{ level, target, message }`) onto the driver's `LogLevel` and re-emits it
through `IClientContext.getLogger()`, tagged `[kernel <target>] …`.
- Kernel verbosity follows the driver logger's level: `IDBSQLLogger` gains an
optional `getLevel()` (implemented by `DBSQLLogger`); the bridge passes it to
the kernel so events the sink would drop never cross the bridge. Defaults to
`info` for loggers that don't expose a level.
- Process-global, last-writer-wins + graceful no-op on an older binding without
the bridge export (logging is advisory) — see SeaLogging docs.
Requires kernel napi `initKernelLogging`/`setKernelLogLevel`/`LogRecord`
(databricks-sql-kernel#126); `KERNEL_REV` bumped + binding rebuilt so the
generated `native/sea/index.d.ts` carries them.
Verified: tsc clean, eslint + prettier clean, SEA unit suite 256 passing (incl.
new SeaLogging unit tests), and a live end-to-end run confirms a single
DBSQLLogger file holds both driver lines and 29 `[kernel databricks::sql::kernel]`
lines for one `SELECT 1` (committed as tests/e2e/sea/logging-e2e.test.ts).
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
* [SEA-NodeJS] Retarget kernel log level on runtime logger.setLevel()
Follow-up to the unified-logging wiring: a runtime `logger.setLevel(...)` now
retargets the kernel-side bridge too, not just the driver's own transports —
keeping kernel verbosity in lock-step with the driver's at runtime, not only at
connect.
- `IDBSQLLogger` gains an optional `onLevelChange(listener) => unsubscribe`;
`DBSQLLogger` implements it (fires subscribers from `setLevel`, swallowing a
throwing listener so it can't break level setting).
- `installKernelLogBridge` now returns an unsubscribe handle and, when both the
logger can notify (`onLevelChange`) and the binding can retarget
(`setKernelLogLevel`), subscribes to forward level changes to the kernel.
- `SeaBackend` stores the handle and drops it on `close()` (no stale listener;
the process-global kernel sink follows the existing last-writer-wins model).
Backend-agnostic: `DBSQLLogger` never references the SEA binding — the SEA layer
subscribes via the interface. Loggers without `onLevelChange` keep the
connect-time level; older bindings without `setKernelLogLevel` simply don't
subscribe.
Verified: tsc / eslint / prettier clean; unit suite 1183 passing incl. new
`DBSQLLogger` level-subscription tests + `SeaLogging` runtime-retarget tests
(retarget, unsubscribe, no-notify logger, no-retarget binding). Live: with the
logger started at `warn`, a healthy SELECT logged 0 kernel lines; after
`logger.setLevel('debug')` mid-session the next SELECT logged 12
`[kernel databricks::sql::kernel]` lines — proving the kernel was retargeted.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
* chore(sea): bump KERNEL_REV to kernel main 80b68e1 + regen napi contract
Kernel databricks#126 (logging bridge) and databricks#127 (mTLS identity + custom HTTP headers)
are both merged to kernel main. Pin KERNEL_REV to the unified main SHA
80b68e1eef3b613910183a50dfa4dace854d50dd and regenerate native/sea/index.*
from it. The contract now carries both feature surfaces (gains the mTLS/headers exports from databricks#127).
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
* fix(sea): align napi package name to @databricks/databricks-sql-kernel-*
Kernel databricks#131/databricks#135 renamed the published napi package
@databricks/sql-kernel -> @databricks/databricks-sql-kernel (declaring all 8
target triples + dropping private:true so the umbrella can publish). The
regenerated native/sea/index.js router now emits the new names, so update the
driver to match: the packaging test regex + M0 triple assertion, the version
test hint, the SeaNativeLoader install hint, and native/sea/README.md.
Fixes the 2 failing native-packaging unit tests surfaced by the KERNEL_REV
bump to kernel main 80b68e1.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
---------
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
By changing the Authorization header to use Bearer token - the driver now supports use of AAD tokens and PAT tokens.
#121