An order API occasionally returns empty values, yet the existing logs contain no request parameters from those moments. For Java or Python applications that are connected to ARMS and have Live-Debug enabled, you can tell the AI assistant in natural language which instance to observe, which code to inspect, and which values to capture. The alibabacloud-livedebug skill delivers tasks through CMS ServiceTask. When you diagnose an existing process, you do not need to change code, release a new version, or restart for a new observation point.
Before delivery, verify the target service, instances, and fields to capture. Snapshots may contain business-sensitive information. Validate expressions and capture overhead on a test instance first, and limit instances, fields, capture count, and duration in production diagnostics.
Prerequisites
|
Requirement |
What you need to prepare |
|
Target application |
A Java or Python application connected to ARMS. The target instance is running and Live-Debug is enabled. |
|
Local tools |
An AI assistant that supports Agent Skills, Alibaba Cloud CLI 3.3.15 or later, and available cms2 and sls commands. When you use the scripts that ship with the skill, Bash 3.2+ and Python 3.8+ are also required locally. |
|
Permissions |
To use all features, the CLI login account must have AliyunARMSFullAccess permission. |
Step 1: Install and configure Alibaba Cloud CLI
Install the CLI
Choose an installation method for your operating system, and check the version after installation. For details, see Install, update, and uninstall Alibaba Cloud CLI.
aliyun version
Configure credentials
Configure CLI credentials for the target account. CMS and SLS share the selected identity. You can reuse an existing RAM role or temporary credentials. For details, see Configure and manage credentials.
Check the CMS and SLS commands
aliyun cms2 apm service-task --help
aliyun sls get-logs-v2 --help
If cms2 is not found, verify that the CMS plug-in aliyuncms2 is installed. To install it manually, place the executable that matches your operating system and architecture in ~/.aliyun/ or on PATH, and then check the commands again. The help commands confirm that the local entry point is available. Actual authorization is checked when you access the target resources.
Step 2: Install the Live-Debug Agent Skill
Install alibabacloud-livedebug in your AI assistant, reload skills, and then invoke the skill by name in a project conversation. Installation entry points and invocation methods differ across clients such as QoderWork, Cursor, and Claude Code.
Step 3: Prepare application access information
Create .arms-info in the root directory of the open project. The following four items are required, and all of them can be found in the same CloudMonitor workspace. The optional targetIp restricts diagnostics to a single instance. If you omit this line, the task applies to all instance IPs of the application by default.
workspace=<workspace ID>
regionId=<region ID>
serviceId=<application unique identifier>
slsProject=<SLS Project name of Application Monitoring>
You can use the following prompt in your coding agent to obtain this information:
Use Alibaba Cloud CLI to query the access region of CloudMonitor workspace xx and the serviceId of application xx, and then query the workspace's Trace Project (slsProject). Return only the required fields.
In addition to creating the .arms-info file, you can also tell your coding agent this information directly in the chat.
Step 4: Start a diagnosis in natural language
In your request, specify the application language, service and instance, and the question to answer. For probes, also specify the code location, trigger condition, fields to capture, and duration or count. Review the configuration generated by the skill before delivery. Each taskConfig is a single JSON object. After creation, obtain the task ID from data.taskId.
Dynamic logs
Java example: "When com.example.service.OrderService.findById returns, record the order number (the first argument) and the latency of this call, up to five times."
Reference configuration (taskType = live_debug_log_probe)
{
"probeType": "LOG",
"language": "java",
"target": {
"typeName": "com.example.service.OrderService",
"methodName": "findById",
"location": "exit",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "LOG",
"template": "id=${args[0]} cost=${durationMs}ms",
"templateSegments": [
{"type": "TEXT", "value": "id="},
{"type": "EXPRESSION", "value": "args[0]"},
{"type": "TEXT", "value": " cost="},
{"type": "EXPRESSION", "value": "durationMs"},
{"type": "TEXT", "value": "ms"}
]
},
"captureCount": 5
}
Python example: "When OrderService.create_order in app.service.order returns, record order_id and the latency of this call, up to five times."
Reference configuration (taskType = live_debug_log_probe)
{
"probeType": "LOG",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "LOG",
"template": "id={order_id} cost={@duration}ms"
},
"captureCount": 5
}
Method snapshots
Java example: "When com.example.service.PaymentService.processPayment throws an exception, capture the arguments, exception information, and call stack, up to five times."
Reference configuration (taskType = live_debug_snapshot_probe)
{
"probeType": "SNAPSHOT",
"language": "java",
"target": {
"typeName": "com.example.service.PaymentService",
"methodName": "processPayment",
"location": "exception",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "SNAPSHOT",
"capture": ["ARGS", "EXCEPTION", "STACK"]
},
"captureCount": 5
}
Python example: "When OrderService.create_order in app.service.order returns, capture order_id, the return value, and the call stack, up to five times."
Reference configuration (taskType = live_debug_snapshot_probe)
{
"probeType": "SNAPSHOT",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "SNAPSHOT",
"capture": ["RETURN", "STACK"],
"captureExpressions": ["order_id"]
},
"captureCount": 5
}
Dynamic metrics
Python example: "When OrderService.create_order returns, record the amount of this call in the order amount histogram livedebug.order.amount for one hour." The METRIC probe in the current skill is available for Python.
Reference configuration (taskType = live_debug_metric_probe)
{
"probeType": "METRIC",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "METRIC",
"metricName": "livedebug.order.amount",
"metricType": "HISTOGRAM",
"valueExpression": "amount"
},
"ttl": "1h"
}
Dynamic spans
Python example: "Add a span named dyn.create_order to OrderService.create_order and record the latency and order number of this call for 30 minutes." The SPAN and SPAN_TAG probes in the current skill are available for Python.
Reference configuration (taskType = live_debug_span_probe)
{
"probeType": "SPAN",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "enter",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "SPAN",
"spanName": "dyn.create_order",
"spanTags": {
"order.id": "str(order_id)"
}
},
"ttl": "30m"
}
If the current request already has a span being recorded, you can tag it directly: "When create_order returns, write order_id to the order.id attribute of the current span."
Reference configuration (taskType = live_debug_span_tag_probe)
{
"probeType": "SPAN_TAG",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["<target instance ID>"]
},
"action": {
"type": "SPAN_TAG",
"tags": [
{"key": "order.id", "value": "str(order_id)"}
]
},
"ttl": "30m"
}
One-time diagnostic commands
To inspect the current state of an instance, deliver a command once without triggering business requests. Each example below provides the taskType for creating the task and the complete taskConfig. Replace the placeholders in the top-level instanceIds with the target instance ID. Python examples correspond to Robin 3.7.0.
Thread information (GET_THREAD_INFO)
taskType = live_debug_get_thread_info
Java example: "List the top five threads by CPU usage in the target JVM with a 500-millisecond sampling interval."
{
"commandType": "GET_THREAD_INFO",
"language": "java",
"params": {"topN": 5, "sampleInterval": 500},
"instanceIds": ["<target instance ID>"]
}
Python example: "View the current call stacks of up to five threads in the target Python process, with up to 10 frames per thread."
{
"commandType": "GET_THREAD_INFO",
"language": "python",
"params": {"limit": 5, "stackTraceDepth": 10},
"instanceIds": ["<target instance ID>"]
}
Memory information (GET_MEMORY_INFO)
taskType = live_debug_get_memory_info
Java example: "View the current heap, non-heap, and buffer pool memory usage of the JVM."
{
"commandType": "GET_MEMORY_INFO",
"language": "java",
"params": {},
"instanceIds": ["<target instance ID>"]
}
Python example: "View the counts and collection thresholds for each generation of the Python garbage collector."
{
"commandType": "GET_MEMORY_INFO",
"language": "python",
"params": {},
"instanceIds": ["<target instance ID>"]
}
Runtime information (GET_RUNTIME_INFO)
taskType = live_debug_get_runtime_info
Java example: "View JVM runtime information and class loading statistics."
{
"commandType": "GET_RUNTIME_INFO",
"language": "java",
"params": {"sections": ["RUNTIME", "CLASS_LOADING"]},
"instanceIds": ["<target instance ID>"]
}
Python example: "Query the Python version, PID, and number of loaded modules of the target process."
{
"commandType": "GET_RUNTIME_INFO",
"language": "python",
"params": {},
"instanceIds": ["<target instance ID>"]
}
Find types (SEARCH_TYPE)
taskType = live_debug_search_type
Java example: "Check whether the JVM has loaded com.example.service.OrderService and display detailed class information."
{
"commandType": "SEARCH_TYPE",
"language": "java",
"params": {"classPattern": "com.example.service.OrderService", "detail": true},
"instanceIds": ["<target instance ID>"]
}
Python example: "Search for the JSONDecoder class in the loaded json.decoder module."
{
"commandType": "SEARCH_TYPE",
"language": "python",
"params": {"moduleName": "json.decoder", "classPattern": "JSONDecoder"},
"instanceIds": ["<target instance ID>"]
}
Find methods (SEARCH_METHOD)
taskType = live_debug_search_method
Java example: "List methods whose names start with find in OrderService and display signatures to distinguish overloads."
{
"commandType": "SEARCH_METHOD",
"language": "java",
"params": {"classPattern": "com.example.service.OrderService", "methodPattern": "find*", "detail": true},
"instanceIds": ["<target instance ID>"]
}
Python example: "Search for JSONDecoder.raw_decode in the loaded json.decoder module and view the parameter names and definition line numbers."
{
"commandType": "SEARCH_METHOD",
"language": "python",
"params": {"moduleName": "json.decoder", "classPattern": "JSONDecoder", "methodPattern": "raw_decode"},
"instanceIds": ["<target instance ID>"]
}
View loaded implementations (DECOMPILE)
taskType = live_debug_decompile
Java example: "View the decompilation result of the OrderService.findById method loaded in the JVM."
{
"commandType": "DECOMPILE",
"language": "java",
"params": {"className": "com.example.service.OrderService", "methodName": "findById"},
"instanceIds": ["<target instance ID>"]
}
Python example: "View the source code of the loaded json.decoder.JSONDecoder.raw_decode, or the bytecode disassembly when the source code is unavailable."
{
"commandType": "DECOMPILE",
"language": "python",
"params": {"moduleName": "json.decoder", "qualname": "JSONDecoder.raw_decode"},
"instanceIds": ["<target instance ID>"]
}
Evaluate expressions (EVALUATE_EXPRESSION)
taskType = live_debug_evaluate_expression
Java example: "Read the java.version property of the target JVM."
{
"commandType": "EVALUATE_EXPRESSION",
"language": "java",
"params": {"expression": "@java.lang.System@getProperty(\"java.version\")"},
"instanceIds": ["<target instance ID>"]
}
Python example: "Read the recursion depth limit of the target Python interpreter."
{
"commandType": "EVALUATE_EXPRESSION",
"language": "python",
"params": {"expression": "import sys\nresult = sys.getrecursionlimit()"},
"instanceIds": ["<target instance ID>"]
}
Inspect object instances (INSPECT_OBJECT)
taskType = live_debug_inspect_object
Java example: "View an OrderService bean instance in the Spring container and expand one level of fields."
{
"commandType": "INSPECT_OBJECT",
"language": "java",
"params": {"className": "com.example.service.OrderService", "limit": 1, "expand": 1},
"instanceIds": ["<target instance ID>"]
}
|
Configuration |
Java probes |
Python probes |
|
Target method |
typeName is the fully qualified class name, and methodName is the method name. For overloads, add overloadSignature (JVM method descriptor). |
typeName is the runtime module name, and methodName is the function's |
|
Value expressions |
Use args[0] for the first argument. On a normal exit, returnValue and durationMs are available. Log templates use ${…} and provide the corresponding templateSegments. |
Use argument names and variables visible in the current scope. Log templates use {…}. On a normal exit, @return and @duration are available; at an exception location, @exception. |
|
Capture location and scope |
target.location specifies enter, exit, exception, or line:N. The probe instance scope is in target.instanceIds. |
Same as Java. Line-level logs or snapshots can also use sourceFile and line:N. SPAN supports function level only. |
Step 5: Verify results and clean up probes
Save the taskId and actual task type returned at creation. In the Trace Project of the current CloudMonitor workspace, query the fixed logstore logstore-apm-logs by taskId. The time window should cover when the task was delivered and executed. If the Trace Project is known, provide it directly. If it is omitted, the new version of the skill obtains it from data.entryPointInfo.project in the workspace APM configuration.
|
Task |
What to check first |
How to verify |
|
LOG / SNAPSHOT |
Installation status of the target instance in Task Status |
Make a request hit that instance and code path, and then verify the template log or snapshot fields in Capture Results. |
|
Python metrics / spans |
Probe installation status and actual triggering |
Verify the metric name, tags, and time window in the corresponding metric view, and verify the span name or added attributes in the trace of the target request. |
|
Java / Python one-time commands |
Command results of the target instance by taskId |
When querying thread CPU rankings in Java, verify the thread list of the target JVM. When querying thread stacks in Python, find the record whose livedebug.report_type is command_result, confirm that state is SUCCESS, and then check result.threads. |
|
Command |
Java |
Python |
|
GET_THREAD_INFO |
Thread CPU ranking, single-thread details, or blocking status |
Thread ID, name, and call stack; threadId can be specified |
|
GET_MEMORY_INFO |
Heap, non-heap, and buffer pool usage |
GC counts and thresholds; process peak RSS when the platform supports it |
|
GET_RUNTIME_INFO |
JVM runtime parameters, GC, class loading, and other information |
Interpreter version, PID, thread count, and number of loaded modules |
|
SEARCH_TYPE / SEARCH_METHOD |
Find loaded classes and their methods |
Find classes, functions, and methods in the specified loaded module |
|
DECOMPILE |
View the implementation of loaded classes or methods |
View the source code of the target function; returns bytecode disassembly when unavailable |
|
EVALUATE_EXPRESSION |
Execute OGNL expressions |
Execute Python expressions or code |
|
INSPECT_OBJECT |
Inspect object instances |
Not supported |
You can ask the assistant: "Check the status and results of the taskId just now. Tell me which instances installed or executed successfully and what was actually captured." If you only have the creation receipt or installation status, you still need to query the actual output.
When the diagnosis ends, you can say: "Delete only the probes created this time, and verify again by the original task type." To delete delivered probes, use DeleteServiceTask. List, Get, and Delete all require a matching type. To inventory all probes, list them by probe type. Verify the task list and impact scope before batch cleanup.
FAQ
The task was created successfully. Why is there no result yet?
Check taskId, the workspace's Trace Project, the SLS region, and the query time first. For probes, verify one by one that the instance matches, the installation status, that business requests actually hit, that filter conditions are met, and whether ttl or the capture count is exhausted. For Java, also check the runtime class name and overload signature. For Python, check the module name, __qualname__, or file path. For one-time commands, check the instance scope, language, and command parameters. If Python returns FAILED or TIMEOUT, check the error code in the result of the receipt.
Where should I look for ProjectNotExist or permission errors?
For ProjectNotExist, verify the Trace Project name of the current CloudMonitor workspace and its SLS region, and set the Logstore to logstore-apm-logs. If 403 is returned, check which step failed first. Automatic discovery of the Trace Project requires cms:GetServiceObservability, and querying the logstore requires log:GetLogStoreLogs.
Why are no tasks listed, or why is the probe still working?
Query by the exact type used at creation. For example, logs use live_debug_log_probe and snapshots use live_debug_snapshot_probe. Creating another task with enabled:false does not disable a delivered probe. Delete the original taskId, and then verify again with the same type.