Skip to content

Expose Debug API through the CLI#7133

Open
sorindumitru wants to merge 3 commits into
spiffe:mainfrom
sorindumitru:debug-api
Open

Expose Debug API through the CLI#7133
sorindumitru wants to merge 3 commits into
spiffe:mainfrom
sorindumitru:debug-api

Conversation

@sorindumitru

@sorindumitru sorindumitru commented Jul 9, 2026

Copy link
Copy Markdown
Member

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
Agent and server CLIs

Description of change
The debug API is now exposed through the CLI, making it easier to use.

Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Copilot AI review requested due to automatic review settings July 9, 2026 09:25
@sorindumitru sorindumitru changed the title Debug api Expose Debug API through the CLI Jul 9, 2026

Copilot AI 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.

Pull request overview

This PR exposes the existing Agent and Server Debug APIs via new CLI subcommands (debug getinfo), making it easier for operators to retrieve runtime debug information (uptime, counts, and SVID chain) without writing custom clients.

Changes:

  • Add spire-server debug getinfo backed by the server Debug gRPC API, including CLI wiring and tests.
  • Add spire-agent debug getinfo backed by the agent Debug gRPC API, including OS-specific socket/named-pipe handling and tests.
  • Update CLI documentation and the agent sample config to surface the new debug functionality.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
doc/spire_server.md Documents new spire-server debug getinfo command and flags
doc/spire_agent.md Documents new spire-agent debug getinfo command and flags
conf/agent/agent.conf Updates sample agent config to include an Admin API socket path
cmd/spire-server/util/util.go Adds NewDebugClient() to the server CLI client interface
cmd/spire-server/cli/debug/debug.go Implements spire-server debug getinfo command and pretty output
cmd/spire-server/cli/debug/debug_posix_test.go POSIX usage string expectations for server debug command
cmd/spire-server/cli/debug/debug_windows_test.go Windows usage string expectations for server debug command
cmd/spire-server/cli/debug/debug_test.go Unit tests for server debug command behavior/output
cmd/spire-server/cli/cli.go Registers debug getinfo in the server CLI command map
cmd/spire-agent/cli/debug/debug.go Implements spire-agent debug getinfo command and pretty output
cmd/spire-agent/cli/debug/debug_posix.go POSIX socket flag/address handling for agent debug command
cmd/spire-agent/cli/debug/debug_windows.go Windows named-pipe flag/address handling for agent debug command
cmd/spire-agent/cli/debug/debug_posix_test.go POSIX usage + helper setup for agent debug tests
cmd/spire-agent/cli/debug/debug_windows_test.go Windows usage + helper setup for agent debug tests
cmd/spire-agent/cli/debug/debug_test.go Unit tests for agent debug command behavior/output
cmd/spire-agent/cli/cli.go Registers debug getinfo in the agent CLI command map

Comment thread conf/agent/agent.conf
server_address = "127.0.0.1"
server_port = "8081"
socket_path ="/tmp/spire-agent/public/api.sock"
admin_socket_path ="/tmp/spire-agent/private/admin.sock"
Comment thread doc/spire_agent.md
Comment on lines +390 to +392
Prints debug information about the agent, including uptime, last successful
sync time, cached SVID counts, and the agent's own SVID chain.

Comment on lines +93 to +96
env.Printf("Agent Debug Info:\n")
env.Printf(" Uptime: %s\n", (time.Duration(resp.Uptime) * time.Second).String())
env.Printf(" Last Sync Success: %s\n", time.Unix(resp.LastSyncSuccess, 0).UTC().Format(time.RFC3339))
env.Printf(" Cached X.509 SVIDs: %d\n", resp.CachedX509SvidsCount)
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.

3 participants