Updated on 2025-11-19 GMT+08:00

Querying a Line-Level Flame Graph

Function

This API is used to query a line-level flame graph.

URI

POST /v1/apm2/openapi/view/profiling/flame-line-tree

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

from

Yes

Long

Start time, for example, 1704271204595.

to

Yes

Long

End time, for example, 1704275169491.

type

Yes

String

Data type. Options: CPU and LATENCY.

instance_id

Yes

Long

Instance ID.

api

Yes

String

API URL, for example, GET_/user/{id}.

region

Yes

String

Region where the instance is located.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

data

Array of strings

Data of a flame graph, which is a two-dimensional array.

data[0][0]: self time, that is, CPU time (in milliseconds) consumed by a method, excluding the time for calling other methods internally.

data[0][1]: total time, that is, CPU time (in milliseconds) consumed by a method, including the time for calling other methods internally.

data[0][2]: method index, corresponding to the array subscript of a method.

data[0][3]: line number.

data[0][4]: a method's child nodes, that is, other methods that are internally called by the current method.

methods

Array of strings

Method information on the call stack, which is a two-dimensional array.

method[0][0]: unique ID of a method.

method[0][1]: package name of a method.

method[0][2]: class name of a method.

method[0][3]: method name.

method[0][4]: method parameter list.

method[0][5]: whether the method is a user method.

method[0][6]: whether the method is a native method.

Example Requests

POST: /v1/apm2/openapi/view/profiling/flame-line-tree

{
    "from": 1704271204595,
    "to": 1704275169491,
    "type": "LATENCY",
    "instance_id": -6870732446083119805,
    "api" : "GET_/user/{id}",
    "region":""
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "data":[
    100,
    1000,
    null,
    [
      [
        700,
        700,
        0, 
	 30, // Line number
        []
      ],
      [
        200,
        200,
        1,
	 40, // Line number
        []
      ]
    ]
  ],
  "methods":[
    [
      2, // method id
      "com.***.foo",
      "SampleService",
      "doService",
      "int,long,String",
      true,  // Whether the method is a user method
      false  // Whether the method is a native method
    ],
    [
      3,
      "com.***.bar",
      "SampleRemoteCall",
      "sampleCallRemoteProcess",
      "float,int",
      true, // Whether the method is a user method
      false // Whether the method is a native method
    ]
  ]}

Status Codes

Status Code

Description

200

OK: The request is successful.

400

Bad Request: Semantic or parameter error.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.