API overview
|
Operation |
HTTP |
Path |
CLI command |
|
Create a task |
|
|
|
|
List tasks |
|
|
|
|
Get a task |
|
|
|
|
Delete a task |
|
|
|
|
Query collection results |
SLS |
(not CMS) |
|
Path parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
ARMS workspace ID, for example |
|
|
string |
Yes |
Application or service ID, for example |
|
|
string |
Required for Get and Delete |
Task ID returned by the create operation |
Common CLI parameters
|
Parameter |
Description |
Default |
|
|
For CMS, the region where the workspace is accessed. For SLS, the region where the workspace's Trace Project resides. |
Default region configured in Alibaba Cloud CLI |
|
|
Specify the CMS endpoint directly, overriding the derivation from the region |
|
|
|
Indented JSON output (the default |
|
Create a task (CreateServiceTask)
Request
POST /serviceTask/{workspace}/{serviceId}/task
Content-Type: application/json
Body parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
Task type, that is, |
|
|
string |
Yes |
IP of the target instance. Set to |
|
|
string (JSON text) |
Yes |
Flattened configuration for a single command or single probe. The server stores it as a string. The CLI |
Call example:
aliyun cms2 apm service-task create \
--workspace '<workspace>' --service-id '<serviceId>' \
--type '<taskType>' --ip '<targetIp>' \
--task-config '<taskConfigJson>' \
--region '<regionId>' -o json
To match all instances, pass
*to--ip.Pass a raw JSON object to
--task-config. You do not need to escape it manually.
Response (CLI output)
{
"success": true,
"data": {
"requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"taskId": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
}
}
|
Field |
Description |
|
|
ID of this request |
|
|
Task ID. Use this value to query SLS results and for the Get and Delete operations. |
Body example (HTTP form after CLI assembly)
{
"type": "live_debug_log_probe",
"ip": "*",
"taskConfig": "{\"probeType\":\"LOG\",\"language\":\"python\",\"target\":{\"typeName\":\"app.service.order\",\"methodName\":\"OrderService.create_order\",\"location\":\"exit\",\"instanceIds\":[\"*\"]},\"action\":{\"type\":\"LOG\",\"template\":\"id={order_id}\"},\"ttl\":\"30m\",\"captureCount\":100}"
}
In the HTTP body, taskConfig is an escaped JSON string. When you pass the value to the CLI --task-config option, pass the unescaped JSON object. The CLI performs the escaping.
List tasks (ListServiceTask)
Request
GET /serviceTask/{workspace}/{serviceId}/tasks?type={taskType}&maxResults={n}
Query parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
Exact task type to match, for example |
|
|
int |
No |
Maximum number of records to return. Default |
Response fields
The CLI outputs the data.serviceTasks[] array. Common fields for each item:
|
Field |
Description |
|
|
Task ID |
|
|
Task type |
|
|
Service ID |
|
|
IP specified at creation, or |
|
|
Creation time |
|
|
Update time |
|
|
JSON text of the task configuration. The content is a single Probe or Command object. |
Call example:
aliyun cms2 apm service-task list \
--workspace '<workspace>' --service-id '<serviceId>' \
--type '<taskType>' --max-results 100 \
--region '<regionId>' -o json
Get a task (GetServiceTask)
Request
GET /serviceTask/{workspace}/{serviceId}/task/{taskId}?type={taskType}
Query parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
Must match the actual task type |
Response
The CLI outputs the data.serviceTask object. Fields are the same as a single item in List.
Call example:
aliyun cms2 apm service-task get \
--workspace '<workspace>' --service-id '<serviceId>' \
--task-id '<taskId>' --type '<taskType>' \
--region '<regionId>' -o json
Delete a task (DeleteServiceTask)
Request
DELETE /serviceTask/{workspace}/{serviceId}/task/{taskId}?type={taskType}
Query parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
Must match the actual task type |
After the task is deleted, the server removes it and calls syncToConfigServer, so the corresponding probe on the agent side stops working. This is the correct way to disable a delivered probe.
Call example:
aliyun cms2 apm service-task delete \
--workspace '<workspace>' --service-id '<serviceId>' \
--task-id '<taskId>' --type '<taskType>' \
--region '<regionId>' -o json
To disable probes in batches, list tasks by their own type, verify the task IDs, and then delete them one by one. The following scope covers all five probe types.
WS='<workspace>'
SVC='<serviceId>'
REGION='<cmsRegion>'
for t in live_debug_log_probe live_debug_snapshot_probe \
live_debug_metric_probe live_debug_span_probe live_debug_span_tag_probe; do
aliyun cms2 apm service-task list \
--workspace "$WS" --service-id "$SVC" --type "$t" --region "$REGION" -o json |
python3 -c 'import sys,json; [print(t["taskId"]) for t in (json.load(sys.stdin)["data"].get("serviceTasks") or [])]' |
while read -r id; do
aliyun cms2 apm service-task delete \
--workspace "$WS" --service-id "$SVC" \
--task-id "$id" --type "$t" --region "$REGION" -o json
done
done
Query collection results (SLS)
Live-Debug task status, dynamic logs, snapshots, and one-time command results are all written to logstore-apm-logs under the Trace Project of the current CloudMonitor workspace. Query the corresponding records by taskId. Dynamic metrics are viewed by metricName in the metric view, and spans and their attributes are viewed in the trace of the target request.
aliyun cms2 apm configuration get \
--workspace '<workspace>' --region '<cmsRegion>' -o json |
python3 -c 'import json, sys; print(json.load(sys.stdin)["data"]["entryPointInfo"]["project"])'
If the workspace's Trace Project is already known, use it directly. To discover the project, the preceding command outputs only data.entryPointInfo.project, avoiding expansion of the ingestion credentials in the same response. Automatic discovery requires cms:GetServiceObservability, and querying the target logstore requires log:GetLogStoreLogs.
The following example queries the last 10 minutes. Replace <taskId> with the ID returned when the task was created, and set <traceProject> and <slsRegion> to the workspace's Trace Project and its SLS region.
FROM=$(( $(date +%s) - 600 )); TO=$(date +%s)
# Task status (installation status, funnel metrics)
aliyun sls get-logs-v2 --region '<slsRegion>' --accept-encoding gzip \
--project '<traceProject>' --logstore logstore-apm-logs \
--from "$FROM" --to "$TO" \
--query "* and \"<taskId>\" | SELECT content FROM log WHERE json_extract_scalar(attributes, '\$[\"livedebug.report_type\"]') = 'status'"
# Capture results (actual captured data)
aliyun sls get-logs-v2 --region '<slsRegion>' --accept-encoding gzip \
--project '<traceProject>' --logstore logstore-apm-logs \
--from "$FROM" --to "$TO" \
--query "* and \"<taskId>\" | SELECT content FROM log WHERE json_extract_scalar(attributes, '\$[\"livedebug.report_type\"]') != 'status'"
# Results of one-time commands only
aliyun sls get-logs-v2 --region '<slsRegion>' --accept-encoding gzip \
--project '<traceProject>' --logstore logstore-apm-logs \
--from "$FROM" --to "$TO" \
--query "* and \"<taskId>\" | SELECT content FROM log WHERE json_extract_scalar(attributes, '\$[\"livedebug.report_type\"]') = 'command_result'"
|
Parameter |
Required |
Description |
|
|
Yes |
Trace Project of the current CloudMonitor workspace |
|
|
Yes |
Fixed to logstore-apm-logs |
|
|
Yes |
Query interval in Unix seconds |
|
|
Yes |
SLS region where the Trace Project resides |
Distinguish returned records by livedebug.report_type.
|
Type |
Filter condition |
Meaning |
|
Task Status |
|
Installation status and funnel metrics |
|
Capture Results |
|
Non-status records, including logs, snapshots, and command receipts. |
|
Command Result |
livedebug.report_type = 'command_result' |
Locate the receipt by taskId and read state, result, and executionTimeMs. |
SLS Projects are isolated by region. An incorrect --region returns ProjectNotExist.
Task type enumeration (taskType/type)
Probe (code instrumentation)
|
taskType |
probeType |
Java Agent 5.3.0 branch |
Robin 3.7.0 branch |
|
live_debug_log_probe |
LOG |
Supported |
Supported |
|
live_debug_snapshot_probe |
SNAPSHOT |
Supported |
Supported |
|
live_debug_metric_probe |
METRIC |
COUNTER, GAUGE |
COUNTER, GAUGE, HISTOGRAM |
|
live_debug_span_probe |
SPAN |
Supported |
Supported |
|
live_debug_span_tag_probe |
SPAN_TAG |
Supported |
Supported |
Both languages share the probe taskTypes. Use taskConfig.language to specify the execution language.
Command (one-time diagnostics)
|
taskType |
commandType |
Java |
Python |
|
live_debug_get_thread_info |
GET_THREAD_INFO |
Supported |
Supported |
|
live_debug_get_memory_info |
GET_MEMORY_INFO |
Supported |
Supported |
|
live_debug_get_runtime_info |
GET_RUNTIME_INFO |
Supported |
Supported |
|
live_debug_search_type |
SEARCH_TYPE |
Supported |
Supported |
|
live_debug_search_method |
SEARCH_METHOD |
Supported |
Supported |
|
live_debug_decompile |
DECOMPILE |
Supported |
Supported |
|
live_debug_evaluate_expression |
EVALUATE_EXPRESSION |
Supported |
Supported |
|
live_debug_inspect_object |
INSPECT_OBJECT |
Supported |
— |
INSPECT_OBJECT inspects object instances in the JVM. The other seven commands are implemented for both languages. Fill in params according to the language.
Common Probe taskConfig structure
The following example lists the fields of a Probe object. Set probeType to one probe type and language to java or python. For the full set of available settings, see the examples for each type below.
{
"probeType": "LOG",
"language": "python",
"target": { },
"action": { },
"trigger": { },
"rateLimit": { },
"ttl": "1h",
"captureCount": 100,
"enabled": true
}
Top-level fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
|
|
|
string |
Yes |
java or python |
|
|
object |
Yes |
Locates the target method or line |
|
|
object |
Yes |
Probe action. The structure varies by |
|
|
object |
No |
Trigger condition |
|
|
object |
No |
Rate control |
|
|
string |
At least one of |
Lifetime. Both languages support values such as 30s, 5m, 2h, and 1d. Python also accepts a plain number of seconds. |
|
|
int |
At least one of |
Maximum number of captures. Collection stops when either this value or ttl is reached first. |
|
|
boolean |
No |
Usually |
target — locate the target
|
Field |
Type |
Required |
Description |
|
|
string |
Recommended for function-level probes |
For Java, the fully qualified class name. For Python, the runtime module name (the key in sys.modules). The main module can be __main__. |
|
|
string |
Recommended for function-level probes |
For Java, the method name, such as findById. For Python, the __qualname__, such as OrderService.create_order. |
|
|
string |
No (recommended for line-level probes) |
Source file name or path suffix |
|
|
string |
No |
Hook point: |
|
|
string[] |
Strongly recommended |
Probes use target.instanceIds to specify instances. ["*"] matches all. For a single instance, enter its actual ID. |
|
|
string[] |
No |
List of effective IPs. Combined with |
|
overloadSignature |
string |
No, Java only |
JVM method descriptor used to distinguish overloads. |
Python line-level probes can use sourceFile and line:N. For Java line-level probes, provide the class name, method name, and corresponding source line, and make sure they match the version loaded by the target instance.
trigger — trigger condition (optional)
|
Field |
Type |
Default |
Description |
|
|
string |
- |
Captures only when true |
|
|
string |
- |
Field for caller filtering. Robin 3.7.0 reads condition when evaluating trigger conditions. |
A Java condition example is args[0].totalAmount > 10000. A Python condition example is amount > 10000.
Method probe expressions are evaluated according to the application language.
Java uses OGNL and can access the first argument through args[0]. On a normal return, returnValue and durationMs are available; on an exception, exception is available.
Python uses the parameters and variables visible in the current frame. On a normal return, @return and @duration (milliseconds) are available; at an exception location, @exception is available.
Log templates use ${expression} in Java and {expression} in Python.
Put the expression directly in trigger.condition. Use exit when you need the return value and exception when you need the exception object.
rateLimit — rate control (optional)
|
Field |
Type |
Default |
Description |
|
|
int |
By probe type (see below) |
Maximum token bucket executions per second |
|
|
double |
1.0 |
Random admission probability (0–1) |
|
|
int |
100 |
Timeout for a single capture (ms) |
Robin 3.7.0 sets default rate limits by probe type. For high-frequency methods, explicitly set maxExecutionsPerSecond and samplingProbability, and limit the capture scope with ttl or captureCount.
Probe actions by type
LOG (taskType: live_debug_log_probe)
Emits dynamic logs at the target point. No object graph serialization is performed.
action fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
Fixed |
|
|
string |
Yes |
Java templates use ${expression} and Python templates use {expression}. |
|
templateSegments |
array |
Provided in the Java example |
Supply TEXT and EXPRESSION segments in template order. Java Agent 5.3.0 can also parse segments from the template. |
The LOG probe renders only the template and ignores capture. To capture arguments, return values, or stacks, use SNAPSHOT.
Python example
{
"probeType": "LOG",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["*"]
},
"action": {
"type": "LOG",
"template": "create_order id={order_id} amount={amount} ret={@return} cost={@duration}ms"
},
"ttl": "30m",
"captureCount": 100
}
Java example: records the order number and latency when findById returns.
{
"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
}
SNAPSHOT (taskType: live_debug_snapshot_probe)
Captures method snapshots and reports them after object graph serialization.
action fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
Fixed |
|
|
string[] |
Yes |
Capture dimension enum. If omitted or set to |
|
|
string[] |
No |
Additional expressions to evaluate |
|
|
object |
No |
Object graph serialization budget |
capture enum
|
Value |
Description |
|
|
Serialize method arguments |
|
|
Serialize the return value |
|
|
Serialize the current instance |
|
|
Record an exception summary |
|
|
Capture local variables. Java line-level variables depend on the debug information of loaded classes. |
|
|
Capture the call stack (opt-in; must be included explicitly) |
|
|
Java can aggregate child calls within a method. Robin 3.7.0 declares this enum, but the snapshot execution path does not implement this dimension. |
captureConfig
|
Field |
Default |
Description |
|
|
3 |
Maximum object serialization depth |
|
|
100 |
Maximum number of elements in a collection or array |
|
|
1024 |
Maximum string length |
|
|
50 |
Maximum number of fields per object |
|
|
65536 |
Maximum bytes per snapshot |
|
|
50 |
Maximum call stack depth |
|
|
Built-in rules vary by language and version |
Regular expressions for redacted fields |
captureExpressions
Java captureExpressions accepts OGNL expressions in the probe context. Python uses restricted expressions in the current frame. The returned context.evaluatedExpressions records the value of each item or the reason it was not captured, as in the following fields.
{"name": "order_id", "type": "...", "value": "...", "notCapturedReason": null}
If evaluation fails, value=null and notCapturedReason records the reason, without affecting other dimensions. captureExpressions and capture are independent of each other.
Python example
{
"probeType": "SNAPSHOT",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["*"]
},
"trigger": {
"condition": "@return is None or amount > 10000"
},
"action": {
"type": "SNAPSHOT",
"capture": ["ARGS"],
"captureExpressions": ["order_id", "amount * count", "self.user_id", "@return"],
"captureConfig": {
"maxDepth": 3,
"maxCollectionSize": 100,
"maxStringLength": 1024
}
},
"ttl": "30m",
"captureCount": 50
}
Java example: captures arguments, the exception, and the call stack when processPayment throws an exception.
{
"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
}
METRIC (taskType: live_debug_metric_probe)
Generates custom metrics at the target point and writes them to the monitoring system.
action fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
Fixed |
|
|
string |
Yes |
Metric name, for example livedebug.order.duration |
|
|
string |
Yes |
Java can record COUNTER and GAUGE. Python can record COUNTER, GAUGE, and HISTOGRAM. Although SUMMARY appears in the Robin enum, the metric executor in this version does not implement it. |
|
|
string |
Explicitly recommended |
Expression that returns a numeric value. Java uses OGNL and Python uses variables in the current frame. |
|
|
object |
No |
Keys are tag names. Java values can use OGNL or ${…} templates; Python values are expressions. |
Python example: records a latency histogram at the create_order exit. Dynamic histograms in Robin 3.7.0 use milliseconds.
{
"probeType": "METRIC",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": [
"*"
]
},
"action": {
"type": "METRIC",
"metricName": "livedebug.order.duration",
"metricType": "HISTOGRAM",
"valueExpression": "@duration"
},
"ttl": "1h"
}
Java example: increments the call count by 1 each time findById returns normally.
{
"probeType": "METRIC",
"language": "java",
"target": {
"typeName": "com.example.service.OrderService",
"methodName": "findById",
"location": "exit",
"instanceIds": [
"<target instance ID>"
]
},
"action": {
"type": "METRIC",
"metricName": "livedebug.order.calls",
"metricType": "COUNTER",
"valueExpression": "1"
},
"ttl": "30m"
}
SPAN (taskType: live_debug_span_probe)
Creates an OTel span during execution of the target function. On an exception, marks the span as ERROR and records an exception event. Function level only.
action fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
Fixed |
|
|
string |
Yes |
Span name |
|
|
object |
No |
Map from attribute name to expression. Java uses OGNL or ${…} templates; Python uses Python expressions. |
Python example
{
"probeType": "SPAN",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "enter",
"instanceIds": ["*"]
},
"action": {
"type": "SPAN",
"spanName": "dyn.create_order",
"spanTags": {
"order.id": "str(order_id)",
"order.amount": "str(amount)"
}
},
"ttl": "1h"
}
Java example: uses dyn.find_order to record method latency and writes the first argument to order.id.
{
"probeType": "SPAN",
"language": "java",
"target": {
"typeName": "com.example.service.OrderService",
"methodName": "findById",
"location": "enter",
"instanceIds": [
"<target instance ID>"
]
},
"action": {
"type": "SPAN",
"spanName": "dyn.find_order",
"spanTags": {
"order.id": "${args[0]}"
}
},
"ttl": "30m"
}
SPAN_TAG (taskType: live_debug_span_tag_probe)
Adds attributes to the currently active span. If there is no active span, the probe skips silently.
action fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
Fixed |
|
|
array |
Yes |
Elements are {"key":"attribute name","value":"expression"}. Java and Python use their own expression syntax. |
Python example
{
"probeType": "SPAN_TAG",
"language": "python",
"target": {
"typeName": "app.service.order",
"methodName": "OrderService.create_order",
"location": "exit",
"instanceIds": ["*"]
},
"action": {
"type": "SPAN_TAG",
"tags": [
{"key": "order.id", "value": "str(order_id)"},
{"key": "order.result", "value": "str(@return)"}
]
},
"ttl": "1h"
}
Java example: writes the order number to order.id of the current span when the method returns.
{
"probeType": "SPAN_TAG",
"language": "java",
"target": {
"typeName": "com.example.service.OrderService",
"methodName": "findById",
"location": "exit",
"instanceIds": [
"<target instance ID>"
]
},
"action": {
"type": "SPAN_TAG",
"tags": [
{
"key": "order.id",
"value": "${args[0]}"
}
]
},
"ttl": "30m"
}
Command taskConfig and examples
Each CreateServiceTask request passes one flattened command object. Put instanceIds at the top level of taskConfig. The taskId is returned by the create operation. The target process executes the command once after receiving it. Query command_result by taskId to verify the execution status and result.
|
Field |
Type |
Description |
|
commandType |
string |
Command enum. Must correspond to the outer type. |
|
language |
string |
java or python. |
|
instanceIds |
string[] |
List of instance IDs on which to execute the command. Replace the placeholders in the examples with actual instance IDs. |
|
params |
object |
Parameters vary by command and language. Pass {} when there are no parameters. |
|
timeout |
number |
Command timeout in milliseconds. The Robin 3.7.0 default is 30000. The value must be greater than 0 and no greater than 30000. |
|
Command |
Common Java params |
Common Python params |
|
GET_THREAD_INFO |
topN and sampleInterval (milliseconds) are used for CPU ranking. Specify threadId to inspect a single thread; blocking is used for blocking diagnosis. |
limit and stackTraceDepth limit the number of threads and the stack depth. threadId restricts the result to a single thread. |
|
GET_MEMORY_INFO |
Pass {}. Returns heap, non-heap, and buffer pool information. |
Pass {}. Returns GC counts and thresholds. Peak RSS is included when the platform supports it. |
|
GET_RUNTIME_INFO |
sections selects the categories of runtime information to return. All categories are returned when omitted. |
Pass {}. Returns the interpreter, platform, PID, thread count, and number of loaded modules. |
|
SEARCH_TYPE |
classPattern matches runtime class names. You can add detail or limit. |
moduleName specifies a loaded module, classPattern matches class names, and limit restricts the number of results. |
|
SEARCH_METHOD |
classPattern matches classes and methodPattern matches methods. detail expands signatures. |
moduleName specifies a loaded module, and classPattern and methodPattern filter classes and methods. |
|
DECOMPILE |
className specifies a class, and methodName can restrict the method. |
Use moduleName and qualname to specify a loaded function. Source code is returned when available; otherwise disassembly is returned. |
|
EVALUATE_EXPRESSION |
expression uses OGNL. |
expression accepts Python code and returns the result through the variable result. The code runs inside the target process. |
|
INSPECT_OBJECT |
className specifies a class. limit and expand restrict the number of instances and the expansion depth. Instances are looked up from the Spring container by default. |
— |
GET_THREAD_INFO
taskType = live_debug_get_thread_info
Java example: lists 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: views 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>"
]
}
GET_MEMORY_INFO
taskType = live_debug_get_memory_info
Java example: views 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: views the counts and collection thresholds for each generation of the Python garbage collector.
{
"commandType": "GET_MEMORY_INFO",
"language": "python",
"params": {},
"instanceIds": [
"<target instance ID>"
]
}
GET_RUNTIME_INFO
taskType = live_debug_get_runtime_info
Java example: views JVM runtime information and class loading statistics.
{
"commandType": "GET_RUNTIME_INFO",
"language": "java",
"params": {
"sections": [
"RUNTIME",
"CLASS_LOADING"
]
},
"instanceIds": [
"<target instance ID>"
]
}
Python example: queries the Python version, PID, and number of loaded modules of the target process.
{
"commandType": "GET_RUNTIME_INFO",
"language": "python",
"params": {},
"instanceIds": [
"<target instance ID>"
]
}
SEARCH_TYPE
taskType = live_debug_search_type
Java example: checks whether the JVM has loaded com.example.service.OrderService and displays detailed class information.
{
"commandType": "SEARCH_TYPE",
"language": "java",
"params": {
"classPattern": "com.example.service.OrderService",
"detail": true
},
"instanceIds": [
"<target instance ID>"
]
}
Python example: searches 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>"
]
}
SEARCH_METHOD
taskType = live_debug_search_method
Java example: lists methods whose names start with find in OrderService and displays 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: searches for JSONDecoder.raw_decode in the loaded json.decoder module and views 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>"
]
}
DECOMPILE
taskType = live_debug_decompile
Java example: views 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: views 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_EXPRESSION
taskType = live_debug_evaluate_expression
Java example: reads 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: reads 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
taskType = live_debug_inspect_object
Java example: views an OrderService bean instance in the Spring container and expands one level of fields.
{
"commandType": "INSPECT_OBJECT",
"language": "java",
"params": {
"className": "com.example.service.OrderService",
"limit": 1,
"expand": 1
},
"instanceIds": [
"<target instance ID>"
]
}
Errors and notes
|
Symptom |
Possible cause |
Recommended action |
|
|
Incorrect SLS region |
Pass the region that matches the Project explicitly with |
|
List returns no results but the task exists |
|
List by each exact type |
|
The probe still works after you create a task with |
The new task does not affect delivered tasks |
Delete the task with DeleteServiceTask |
|
The probe produces no data |
Instance scope, runtime class or module name, trigger location, or traffic does not match |
Verify the instance selection, class or module name, and method or line number, trigger the target request, and then check the status. |
|
SPAN creation fails or is ineffective |
|
Use function-level |
|
Python ttl error |
The |
Use |
|
The command is created but no result appears |
Target instance, language, query window, or parameters do not match |
Check the top-level instanceIds, query command_result by taskId, and check state and result. |
Complete call chain example (LOG probe)
# 0. Environment
REGION=cn-hangzhou
SLS_PROJECT='<Trace Project of the current workspace>'
SLS_REGION='<SLS region where the Trace Project resides>'
WORKSPACE=default-cms-xxxxxxxxxxxxxxxxxx-cn-hangzhou
SERVICE_ID='ggxw4lnjuz@f2fd3a6265a254a052afb'
# 1. Create
RESP=$(aliyun cms2 apm service-task create \
--workspace "$WORKSPACE" --service-id "$SERVICE_ID" \
--type live_debug_log_probe --ip '*' \
--task-config '{"probeType":"LOG","language":"python","target":{"typeName":"app.service.order","methodName":"OrderService.create_order","location":"exit","instanceIds":["*"]},"action":{"type":"LOG","template":"id={order_id} ret={@return}"},"ttl":"30m","captureCount":50}' \
--region "$REGION" -o json)
echo "$RESP"
TASK_ID=$(echo "$RESP" | python3 -c 'import sys,json; print(json.load(sys.stdin)["data"]["taskId"])')
# 2. Verify the task
aliyun cms2 apm service-task get \
--workspace "$WORKSPACE" --service-id "$SERVICE_ID" \
--task-id "$TASK_ID" --type live_debug_log_probe \
--region "$REGION" -o json
# 3. Trigger business traffic, then query results (last 10 minutes)
FROM=$(( $(date +%s) - 600 )); TO=$(date +%s)
aliyun sls get-logs-v2 --region "$SLS_REGION" --accept-encoding gzip \
--project "$SLS_PROJECT" --logstore logstore-apm-logs \
--from "$FROM" --to "$TO" \
--query "* and \"$TASK_ID\" | SELECT content FROM log WHERE json_extract_scalar(attributes, '\$[\"livedebug.report_type\"]') != 'status'"
# 4. Clean up
aliyun cms2 apm service-task delete \
--workspace "$WORKSPACE" --service-id "$SERVICE_ID" \
--task-id "$TASK_ID" --type live_debug_log_probe \
--region "$REGION" -o json