sentry-top-threads

Retrieves a top CPU thread dump from a remote sentry.

Command properties

PropertyDescription
Command typeTransforming
Required permissionAdministrator
License usageN/A
Parallel executionSupported
Distributed executionNot supported

Syntax

sentry-top-threads [timeout=INT]

Options

timeout=INT
RPC timeout in seconds. Accepts a value between 1 and 600. (Default: 30)

Input fields

FieldTypeRequiredDescription
guidstringRequiredSentry unique identifier.

Output fields

FieldTypeDescription
guidstringSentry unique identifier.
tidlongThread ID.
namestringThread name.
statestringThread state (e.g., RUNNABLE, WAITING, BLOCKED).
priorityintegerThread priority.
usagedoubleCPU usage.
stacktracestringStack trace.
_errorstringError message added to the original record if an error occurs.

Error codes

Parsing errors
Error codeMessageDescription
23100No permission to call sentry RPC.A user without administrator privileges ran the command.
23101Invalid sentry RPC timeout option value. Use a value between 1 and 600.The timeout option value is not an integer or is outside the range 1–600.
Runtime errors

Errors are returned via the _error field:

Error messageDescription
guid is nullThe guid field value in the input record is null.
guid should be stringThe guid field value in the input record is not a string.
guid should be non empty stringThe guid field value in the input record is an empty string.
not connectedThe sentry is not connected.
timeoutThe RPC request timed out.
disconnectedThe connection was lost while processing the RPC request.

Other RPC exception messages may be returned depending on the state of the system where the sentry is installed.

Description

The sentry-top-threads command reads the guid field of each input record, sends an asynchronous RPC message to the corresponding sentry, and retrieves dump information for the top CPU-consuming threads.

Results are returned in the order RPC response messages are received from sentries, so the output record order may differ from the input record order.

The maximum length of the asynchronous RPC request queue is 100 by default and can be adjusted using the logpresso.core.sentry_rpc_parallel environment variable.

To retrieve results from all Data Nodes at once in a cluster environment, use the sonar-sentry-top-threads command.

Examples

  1. Retrieve top CPU threads from all sentries

    sentry | fields guid | sentry-top-threads
    

    Retrieves the top CPU-consuming thread dump from all connected sentries.

  2. Sort by CPU usage descending

    sentry | fields guid | sentry-top-threads | sort -usage
    

    Retrieves the top CPU threads from all sentries sorted by CPU usage in descending order.

  3. Retrieve with a 120-second timeout

    sentry | fields guid | sentry-top-threads timeout=120
    

    Retrieves the top CPU thread dump from sentries with the RPC timeout set to 120 seconds.