Skip to content

fix(kernel): forward telemetry_flush_interval_ms to the kernel - #1026

Merged
vuanhphung merged 2 commits into
mainfrom
vuanhphung/kernel-telemetry-flush-interval
Nov 12, 2026
Merged

vuanhphung merged 2 commits into
mainfrom
vuanhphung/kernel-telemetry-flush-interval

Conversation

@vuanhphung

Copy link
Copy Markdown
Collaborator

On the kernel path, connect(telemetry_flush_interval_ms=...) is silently dropped. _kernel_telemetry_kwargs forwards enable_telemetry, telemetry_batch_size, and the circuit-breaker flag, but not the flush interval, even though the kernel Session accepts telemetry_flush_interval_ms. Every kernel connection therefore flushes on the kernel's 5s default timer.

This made databricks-driver-test TELEMETRY-015 flaky. That test asks for a 300s interval so that only session closes export telemetry. In nightly run 43146507303, a slow first SELECT (12.4s) let the 5s timer fire exactly 5.0s after the host telemetry client was created. The upload carried the test's two CREATE_SESSION events before any close.

The connector now forwards an explicit telemetry_flush_interval_ms to the kernel. When the option is unset, nothing is sent and the kernel keeps its default. Thrift is unchanged; its exporter still flushes every 300s. The option is documented in CONNECTION_PARAMETERS.md.

Validation:

  • Unit tests: 1334 passed (-m "not realkernel"). Real-kernel tests passed against kernel 6f4b6d6 (the current KERNEL_REV). black --check src and mypy src are clean.
  • Live repro against the pecotesting warehouse: two kernel sessions with telemetry_flush_interval_ms=300_000, then a 12s stall before any close. On main, a telemetry upload landed 5.0s after the first CreateSession. With this branch there were no uploads until close.
  • The driver-test test_telemetry.py module in kernel mode passed 3/3 runs with this branch. test_feature_flags.py (kernel, non-OAuth cases) also passed.

This pull request and its description were written by Isaac.

The kernel binding accepts telemetry_flush_interval_ms, but the connector
never forwarded it, so kernel connections always used the kernel's 5s
default timer even when the caller asked for a longer interval.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@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 Low

Looks good. The fix is small and correctly scoped. The new kwarg goes through the existing _kernel_session_accepts_kwarg gate, so older kernel wheels are unaffected. An unset value is omitted so the kernel keeps its default, and the session threading, the forwarding, the unset case and the fixed-signature filtering all have tests. One low concern: the "must be positive" contract is documented but not validated in the connector.

PyO3 accepts True as 1ms and reports negative or non-int values with a
conversion error that does not name the option.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@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 Low

Looks good. The fix is small and well tested, with one low concern: on older kernel wheels an explicitly set flush interval is still dropped without any error or warning. Validation, the unset → omitted behavior, and the threading through session.py all have tests.

@vuanhphung
vuanhphung added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 8d6db43 Nov 12, 2026
58 of 60 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 131228c5 Deployed Nov 12, 2026 by peco-review-bot[bot] via followup #1797
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