Uh oh!
There was an error while loading. Please reload this page.
Introduce app logs command - #3908
Conversation
pkosiec
left a comment
There was a problem hiding this comment.
Thank you @ericfeunekes for your contribution! The new app logs command is super helpful. I tested the changes and it works well 👍
Before merge, please take a look at my comments. I can help you implementing the changes if you'd like to - feel free to ping me anytime. Thanks!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@pkosiec I think I've addressed each of your issues and tried to keep them on separate commits to make it easier to review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pietern
left a comment
There was a problem hiding this comment.
Hi @ericfeunekes, thanks for the PR!
The token changes (cmd/auth/token_* and libs/auth/token_*) are not necessary. You can use the TokenSource function on the SDK configuration directly to get a fresh OAuth token. I confirmed that the following patch works: https://gist.github.com/pietern/41d02acc2907416244789c7408fb232f
Please move logstream to libs/apps to make it clearer that it is specific to apps.
Uh oh!
There was an error while loading. Please reload this page.
pietern
commented
Nov 17, 2025
Btw, when I stop an app during tail, the logs command doesn't stop or error. |
pietern
commented
Nov 17, 2025
@ericfeunekes I forgot an important detail in the previous message. Contributing to CLI requires a signed CLA, if that's something you're willing to do, please reach out with a request to sign CLA to dabs-feedback@databricks.com and we will take it from there. Thanks! |
pietern
commented
Dec 3, 2025
@ericfeunekes Can you update the PR summary to match the current state of the PR? |
Commit: 438f019
9 interesting tests: 5 flaky, 2 SKIP, 2 RECOVERED
Top 20 slowest tests (at least 2 minutes):
|
pietern
commented
Dec 3, 2025
@ericfeunekes Thanks for signing the CLA. This PR can proceed. Can you update the PR summary to match the current state of the PR? |
This reverts commit 402e72743d9a9bd6dbdc7c24f1f20d62cededf11.
Replace custom token acquisition logic with SDK's built-in TokenSource function as suggested by @pietern. This simplifies the implementation by delegating token lifecycle management to the SDK configuration. Changes: - Use cfg.GetTokenSource() instead of auth.AcquireToken() - Remove custom token_loader abstraction (libs/auth/token_loader.go) - Revert cmd/auth/token.go to original implementation - Remove tokenAcquireTimeout constant (handled by SDK) This addresses review feedback from @pietern on Nov 17, 2025. Reference: https://gist.github.com/pietern/41d02acc2907416244789c7408fb232f 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Relocate logstream from libs/logstream to libs/apps/logstream to make it clearer that this package is specific to Databricks Apps functionality. Changes: - Move libs/logstream/streamer.go to libs/apps/logstream/streamer.go - Move libs/logstream/streamer_test.go to libs/apps/logstream/streamer_test.go - Update import in cmd/workspace/apps/logs.go This addresses review feedback from @pietern on Nov 17, 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Group individual const declarations into a single const block for better code organization and readability. Changes: - Convert six individual const declarations to const block - Apply alignment formatting This addresses review feedback from @pkosiec on Nov 14, 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
When using --tail-lines with -f (follow), the buffer was flushing too early, showing all historical logs instead of just the last N lines. The tail buffer maintains a rolling window of the last N lines, but it was flushing as soon as it reached N lines when following, rather than waiting for the prefetch window to collect all historical logs first. Fix: Always respect the flush deadline (prefetch window) regardless of follow mode. This allows historical logs to stream in and the rolling buffer to maintain only the truly last N lines before flushing. Example with --tail-lines 10 -f: - Before: Shows lines 1-10, then 11-1000+ (all logs) - After: Shows lines 991-1000, then new logs (correct) This addresses review feedback from @pkosiec on Nov 14, 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Replace magic number (30 seconds) with defaultHandshakeTimeout constant for better code maintainability. Changes: - Add defaultHandshakeTimeout = 30 * time.Second to const block - Use constant in newLogStreamDialer instead of inline value This addresses review feedback from @pkosiec on Nov 12/14, 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
When following app logs (--follow) and the app stops or is deleted, the logs command now detects this and exits gracefully instead of retrying indefinitely. Implementation: - Added AppStatusChecker callback to logstream.Config - Check app status before each reconnect attempt in follow mode - Also check when connection closes normally during follow - Exit with clear error message when app is stopped/deleting/error state This addresses @pietern's comment about the command not stopping when the app is stopped during tail. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
pkosiec
left a comment
There was a problem hiding this comment.
Awesome work @ericfeunekes! Thanks a lof for your contribution!
I rebased the PR, updated its title and desc to merge it soon! 🚀
Uh oh!
There was an error while loading. Please reload this page.
## Changes See #3908. This is worth calling out in the changelog.
eng-dev-ecosystem-bot
commented
Dec 4, 2025
Commit: 27ba2ab
21 interesting tests: 10 flaky, 7 KNOWN, 3 RECOVERED, 1 SKIP
Top 50 slowest tests (at least 2 minutes):
|
## Release v0.279.0 ### Notable Changes * New deployment engine for DABs that does not require Terraform is available to try in experimental mode. Not recommended for production workloads yet. Documentation at [docs/direct.md](docs/direct.md). ### CLI * Introduce `databricks apps logs` command to tail app logs from the CLI ([#3908](#3908)) ### Bundles * Add support for alerts to DABs ([#4004](#4004)) * Allow `file://` URIs in job libraries to reference runtime filesystem paths (e.g., JARs pre-installed on clusters via init scripts). These paths are no longer treated as local files to upload. ([#3884](#3884)) * Pipeline catalog changes now trigger in-place updates instead of recreation (Terraform provider v1.98.0 behavior change) ([#4082](#4082)) ### Dependency updates * Bump Terraform provider to v1.98.0 ([#4082](#4082))
## Changes - Add the `databricks apps logs NAME` command, including tail/follow/search/source/output-file flags wired via `cmdgroup`, file mirroring with 0600 perms, and validation against apps that lack a public URL. (`cmd/workspace/apps`) - Introduce the reusable `libs/logstream` helper with token refresh hooks, buffering, search/source filtering, structured error handling, context-driven deadlines, and a comprehensive unit suite so other commands can stream logs without bespoke WebSocket loops. ## Why This is a quality of life addition that allows the CLI to tail app logs without a need to navigate to the Apps UI. ## Tests - go test ./libs/logstream - go test ./cmd/workspace/apps - go test ./cmd/auth <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. --> --------- Co-authored-by: Eric Feunekes <eric.feunekes@pwc.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Pawel Kosiec <pawel.kosiec@databricks.com>
## Changes See #3908. This is worth calling out in the changelog.
## Release v0.279.0 ### Notable Changes * New deployment engine for DABs that does not require Terraform is available to try in experimental mode. Not recommended for production workloads yet. Documentation at [docs/direct.md](docs/direct.md). ### CLI * Introduce `databricks apps logs` command to tail app logs from the CLI ([#3908](#3908)) ### Bundles * Add support for alerts to DABs ([#4004](#4004)) * Allow `file://` URIs in job libraries to reference runtime filesystem paths (e.g., JARs pre-installed on clusters via init scripts). These paths are no longer treated as local files to upload. ([#3884](#3884)) * Pipeline catalog changes now trigger in-place updates instead of recreation (Terraform provider v1.98.0 behavior change) ([#4082](#4082)) ### Dependency updates * Bump Terraform provider to v1.98.0 ([#4082](#4082))

Changes
databricks apps logs NAMEcommand, including tail/follow/search/source/output-file flags wired viacmdgroup, file mirroring with 0600 perms, and validation against apps that lack a public URL. (cmd/workspace/apps)libs/logstreamhelper with token refresh hooks, buffering, search/source filtering, structured error handling, context-driven deadlines, and a comprehensive unit suite so other commands can stream logs without bespoke WebSocket loops.Why
This is a quality of life addition that allows the CLI to tail app logs without a need to navigate to the Apps UI.
Tests