Skip to content

Latest commit

 

History

History
196 lines (127 loc) · 7.51 KB

live-debugger.md

File metadata and controls

196 lines (127 loc) · 7.51 KB

Live Debugger

See Live Debugger for the full guide to managing breakpoints and snapshots with dtctl.

All commands below are experimental and carry an [Experimental] badge in --help: their shape may change in any release. A context pinning min-stability: stable does not expose them.

dtctl docs / Resources / Live Debugger

Supported operations

Operation Resource Command syntax Description Mutating Access
create breakpoint dtctl create breakpoint Create resources from files yes write
delete breakpoint dtctl delete breakpoint Delete resources yes delete
describe breakpoint dtctl describe breakpoint Show details of a specific resource no read
get breakpoints dtctl get breakpoints Display one or many resources no read
update breakpoint dtctl update breakpoint Update resources yes write
get snapshots dtctl get snapshots Display one or many resources no read

Flags

These commands take dtctl's global flags (-o/--output, --context, --jq, -v, and more). Some verbs add their own flags (apply, diff, query, inventory); see the verb in COMMANDS.md. Individual commands may take further flags of their own — run dtctl <verb> <resource> --help for the authoritative list.

Required token scopes

Safety level Scopes
delete dev-obs:breakpoints:set
read dev-obs:breakpoints:set, storage:application.snapshots:read
write dev-obs:breakpoints:set

Output

See Live Debugger.

Examples

See Live Debugger for full examples.

Notes

Prerequisites

Live Debugger requires OAuth authentication. Make sure you're logged in before using these commands:

dtctl auth login

Workspace filters

Workspace filters scope which monitored processes are eligible for breakpoints. Use them in large environments to avoid unnecessary overhead. Filters are workspace-scoped: a single filter set applies to every breakpoint in the workspace. Because of this, changing the filters re-scopes not only breakpoints you create afterwards but all existing breakpoints in the workspace as well.

You can set filters in the same step as creating a breakpoint, so a separate filter command isn't required. Use the standalone command when you want to set or change filters without creating a breakpoint:

# Set workspace filters (e.g. target a specific Kubernetes namespace)
dtctl update breakpoint --filters k8s.namespace.name:prod

Because changing filters re-scopes existing breakpoints, dtctl counts the active breakpoints that would be affected and asks you to confirm before applying the change:

This will change the workspace filters for 3 active breakpoints. Continue? [y/N]:

Pass --yes (-y) to skip the prompt, for example in scripts:

dtctl update breakpoint --filters k8s.namespace.name:prod --yes

Breakpoints that have auto-disabled (for example after reaching their hit limit) aren't counted. In non-interactive contexts (--plain or auto-detected agent mode) the change proceeds without prompting.

Breakpoint lifecycle

Create a breakpoint at a specific source location (file:line), optionally setting workspace filters in the same step:

dtctl create breakpoint com/example/MyService.java:42 --filters k8s.namespace.name:prod

When --filters changes the workspace filters, it also re-scopes existing breakpoints (see Workspace filters above), so you're prompted to confirm unless you pass --yes.

List all breakpoints (the listing includes the log message column):

dtctl get breakpoints

Describe a breakpoint to see full details including its log message, hit count, and status:

dtctl describe breakpoint bp-abc123

Update a breakpoint's condition, log message, or enabled state:

# Add a conditional expression to a breakpoint
dtctl update breakpoint bp-abc123 --condition "userId != null"

# Change the log message emitted when the breakpoint is hit
dtctl update breakpoint bp-abc123 --log-message "Hit on {frame.filename}:{frame.line} user={userId}"

# Disable a breakpoint without deleting it
dtctl update breakpoint bp-abc123 --enabled=false

At least one of --condition, --log-message, or --enabled is required.

Delete breakpoints by ID, by source location, or all at once:

# Delete a single breakpoint by ID
dtctl delete breakpoint bp-abc123

# Delete all breakpoints at a specific source location (file:line)
dtctl delete breakpoint com/example/MyService.java:42

# Delete all breakpoints in the workspace
dtctl delete breakpoint --all

Log message placeholders

The log message supports {variable} placeholders: {frame.*} fields expose the hit location, any other name (for example {userId}) references a captured application variable, and reserved namespaces such as {rook.*} or {controller.*} pass through unchanged. Use the short, friendly form -- messages are displayed the same way in get and describe.

Snapshots

When a breakpoint is hit, the runtime captures a snapshot of local variables and the call stack. Fetch snapshots by breakpoint location or by stable rule ID:

# By location
dtctl get snapshots com/example/PaymentService.java:87

# By stable rule ID (shown after create or in get breakpoints)
dtctl get snapshots dtctl-rule-5bfb45a29fce7a46

# Decode variable data (variant wrappers flattened to plain values)
dtctl get snapshots com/example/PaymentService.java:87 --decode-snapshots

# Structured output
dtctl get snapshots com/example/PaymentService.java:87 -o json

Full vs simplified decoding

By default, --decode-snapshots (equivalent to --decode-snapshots=simplified) produces a simplified view that shows variable names and values in a human-readable format. For the full decoded tree, including nested objects and type annotations, use --decode-snapshots=full:

# Full decoding with complete object graphs
dtctl get snapshots com/example/PaymentService.java:87 --decode-snapshots=full

Safety and dry run

Commands that modify state (create, update, delete) support dry-run mode to preview changes without applying them:

# Preview what would be created without actually creating it
dtctl create breakpoint com/example/MyService.java:42 --dry-run

Safety checks prevent accidental modifications in read-only contexts.

End-to-end example

# 1. Log in with OAuth
dtctl auth login

# 2. Create a breakpoint on a suspect line, setting workspace filters in the same step
dtctl create breakpoint com/example/PaymentService.java:87 --filters k8s.namespace.name:prod

# 3. List breakpoints to confirm
dtctl get breakpoints

# 4. Wait for the breakpoint to be hit, then fetch snapshots
dtctl get snapshots com/example/PaymentService.java:87 --decode-snapshots

# 5. Inspect the decoded variables to diagnose the issue

# 6. Clean up -- delete the breakpoint
dtctl delete breakpoint com/example/PaymentService.java:87