Skip to content

[tctl] Add support for debug sock endpoint with fallback in top#56886

Merged
okraport merged 16 commits intomasterfrom
okraport/tctl-top-metrics-fallback
Jul 22, 2025
Merged

[tctl] Add support for debug sock endpoint with fallback in top#56886
okraport merged 16 commits intomasterfrom
okraport/tctl-top-metrics-fallback

Conversation

@okraport
Copy link
Copy Markdown
Contributor

@okraport okraport commented Jul 17, 2025

With this change tctl top will now attempt to connect to the local socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will always attempt the given address regardless of success. This matches previous behavior.

The implementation is not concurrent as only two options exist, both of which are local and not expected to have long round trips.

Example error when failing to connect to any endpoints:

luke.okraszewski@Mac teleport % ./build/tctl top
ERROR: failed to fetch metrics from addr http://unix
        dial unix /var/lib/teleport/debug.sock: connect: connection refused
failed to fetch metrics from addr http://127.0.0.1:3000
        dial tcp 127.0.0.1:3000: connect: connection refused

Closes: #56673

changelog: tctl top now supports the local unix sock debug endpoint.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 17, 2025

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
okraport/tctl-top-metrics-fallback 0679d5e 22 ✅SUCCEED okraport-tctl-top-metrics-fallback 2025-07-22 11:09:19

@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from c824819 to 495b4d2 Compare July 17, 2025 12:37
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from 495b4d2 to 0cf5dd9 Compare July 17, 2025 12:38
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from 0cf5dd9 to 8945b1f Compare July 17, 2025 12:45
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from 8945b1f to d9d6467 Compare July 17, 2025 12:52
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from d9d6467 to 5d1135d Compare July 17, 2025 13:01
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from 5d1135d to d7bebe9 Compare July 17, 2025 13:10
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from d7bebe9 to 9b55e15 Compare July 17, 2025 13:25
@okraport okraport force-pushed the okraport/tctl-top-metrics-fallback branch from 9b55e15 to 14e3546 Compare July 17, 2025 13:26
Comment thread tool/tctl/common/top/command.go Outdated
Comment thread tool/tctl/common/top/command.go Outdated
Comment thread tool/tctl/common/top/client.go Outdated
Comment thread tool/tctl/common/top/model.go
Comment thread docs/pages/reference/cli/tctl.mdx Outdated
Comment thread tool/tctl/common/top/client/http/client.go Outdated
Comment thread tool/tctl/common/top/command.go Outdated
Comment thread tool/tctl/common/top/command.go Outdated
Comment thread tool/tctl/common/top/model.go
Comment thread tool/tctl/common/top/command.go Outdated
Comment thread tool/tctl/common/top/command.go Outdated
@okraport okraport enabled auto-merge July 22, 2025 10:57
@okraport okraport added this pull request to the merge queue Jul 22, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2025
* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
Merged via the queue into master with commit 3d868ab Jul 22, 2025
43 checks passed
@okraport okraport deleted the okraport/tctl-top-metrics-fallback branch July 22, 2025 12:24
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@okraport See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Failed
branch/v18 Create PR

okraport added a commit that referenced this pull request Jul 22, 2025
* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
okraport added a commit that referenced this pull request Jul 22, 2025
* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
okraport added a commit that referenced this pull request Jul 22, 2025
* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2025
…) (#57026)

* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
github-merge-queue Bot pushed a commit that referenced this pull request Jul 22, 2025
…) (#57027)

* [tctl] Add support for debug sock endpoint with fallback in top

With this change `tctl top` will now attempt to connect to the local
socket debug endpoint before defaulting to the default diag addr.

If the user specifies the endpoint explicitly then the command will
always attempt the given address regardless of success. This matches
previous behavior.

The implementation is not concurrent as only two options exist, both
of which are local and not expected to have long round trips.

Closes: #56673

changelog: `tctl top` now supports the local unix sock debug endpoint.

* refactor: Simplify top address behaviour based on PR feedback

* Refactor top to reuse debug client for metrics.

* fix linting issues

* Update docs to match support for unix sockets

* Fix imports

* refactor debug service

* clean up error handling in top command

* Add footer display for addr

* Docs for diag/client

* update docs and add addr parser tests

* More docs fixes

* Fix linting after rebase

* Better godocs, more URL test cases, fixed user facing errors

* Fix err trace wrapping semantics

---------

Co-authored-by: Tim Ross <tim.ross@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend tctl top to consume metrics via the debug service

4 participants