All Products
Search
Document Center

Application Real-Time Monitoring Service:GetTrace

Last Updated:Aug 28, 2026

You can invoke the GetTrace API to obtain trace details.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

xtrace:SearchTrace

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

TraceID

string

Yes

The trace ID, which is the unique identifier of the trace.

You can obtain the trace ID on the Trace Explorer page in the Managed Service for OpenTelemetry console or by calling the SearchTraces operation.

1c6881aab84191a4******

AppType

string

No

The type of the application. You can leave this parameter empty or set the value to XTRACE. We recommend that you leave it empty.

  • Empty value: queries traces reported from Managed Service for Prometheus and Application Real-Time Monitoring Service (ARMS).

  • XTRACE: queries only traces reported from Managed Service for Prometheus.

XTRACE

RegionId

string

Yes

The ID of the region.

cn-beijing

PageNumber

integer

No

The page number.

1

PageSize

string

No

The number of entries on each page. Maximum value: 100.

5

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

1E2B6A4C-6B83-4062-8B6F-AEEC1F******

Spans

object

Span

array<object>

The list of spans.

array<object>

The list of spans.

SpanId

string

The span ID.

fec891bb8f8XXX

HaveStack

boolean

Indicates whether the span has child spans. Valid values:

  • true

  • false

false

ServiceIp

string

The IP address of the server on which the span resides.

192.168.XXX.XXX

OperationName

string

The name of the span.

/api

ParentSpanId

string

The ID of the parent span.

fec891bb8f8XXX

ResultCode

string

The response code.

200

Duration

integer

The duration of the span. Unit: milliseconds.

1000

RpcId

string

The parent-child and sibling relationship between spans. For example, span 1.1 is the parent of span 1.1.1, and span 1.1.2 and span 1.1.1 are siblings.

1.1

Timestamp

integer

The timestamp when the span was generated. Unit: microseconds.

1689845513298000

ServiceName

string

The name of the application.

server1

TraceID

string

The trace ID, which is the unique identifier of the trace.

1c6881aab84191a4

TagEntryList

object

TagEntry

array<object>

The tags.

object

The tags in the span.

Key

string

The tag key of the span.

logLevel

Value

string

The tag value of the span.

Warning

LogEventList

object

LogEvent

array<object>

The log events.

array<object>

The log events in the trace.

Timestamp

integer

The timestamp when the log event was generated. Unit: microseconds.

1689845513298000

TagEntryList

object

TagEntry

array<object>

The tags.

object

The tags in the log event.

Key

string

The tag key of the log event.

logLevel

Value

string

The tag value of the log event.

Warning

StatusCode

integer

The status code.

200

Examples

Success response

JSON format

{
  "RequestId": "1E2B6A4C-6B83-4062-8B6F-AEEC1F******",
  "Spans": {
    "Span": [
      {
        "SpanId": "fec891bb8f8XXX",
        "HaveStack": false,
        "ServiceIp": "192.168.XXX.XXX",
        "OperationName": "/api",
        "ParentSpanId": "fec891bb8f8XXX",
        "ResultCode": "200",
        "Duration": 1000,
        "RpcId": "1.1",
        "Timestamp": 1689845513298000,
        "ServiceName": "server1",
        "TraceID": "1c6881aab84191a4",
        "TagEntryList": {
          "TagEntry": [
            {
              "Key": "logLevel",
              "Value": "Warning"
            }
          ]
        },
        "LogEventList": {
          "LogEvent": [
            {
              "Timestamp": 1689845513298000,
              "TagEntryList": {
                "TagEntry": [
                  {
                    "Key": "logLevel",
                    "Value": "Warning"
                  }
                ]
              }
            }
          ]
        },
        "StatusCode": 200
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.