Updated on 2023-08-02 GMT+08:00

Obtaining All Data of a Trace

Function

This API is used to obtain all data of a trace.

URI

GET /v1/apm2/openapi/view/trace/get-trace-events

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

trace_id

Yes

String

Trace ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

span_event_list

Array of SpanEventInfo objects

Span event information.

Table 4 SpanEventInfo

Parameter

Type

Description

env_name

String

Environment name.

app_name

String

Component name.

indent

Integer

Indent.

region

String

Region.

host_name

String

Host name.

ip_address

String

IP address.

instance_name

String

Instance name.

event_id

String

ID of an event in a specific span. Example: 1-1-2.

next_spanId

String

Source event ID for the next span invocation.

source_event_id

String

Event ID of the invoker.

method

String

Method.

children_event_count

Integer

Number of sub-events.

discard

Array of DiscardInfo objects

Number of discarded sub-events. Use key to specify the sub-event type.

argument

String

Parameters to be displayed, which vary according to event types.

attachment

Map<String,String>

Attachment in the registration information.

global_trace_id

String

Virtual trace ID.

global_path

String

Path that a virtual trace ID passes through.

trace_id

String

Trace ID.

span_id

String

Span ID.

env_id

Long

Environment ID.

instance_id

Long

Instance ID.

app_id

Long

Component ID.

biz_id

Long

Application ID.

domain_id

Integer

Tenant ID.

source

String

This parameter exists only when a root event exists.

real_source

String

URL that is actually invoked. This parameter exists when a root event exists.

start_time

Long

Start time.

time_used

Long

Time required.

code

Integer

Status code, which is valid for HTTP invocation.

class_name

String

Class name.

is_async

Boolean

Whether the invocation is asynchronous.

tags

Map<String,String>

Custom parameters, header or body parameters, httpMethod, bizCode, or parameters that may be added later.

has_error

Boolean

Whether an error occurs. This parameter is used in span scenarios.

error_reasons

String

Error cause.

type

String

Type, such as mysql and kafka.

http_method

String

http_method in tags. Only the URL monitoring item has this parameter.

biz_code

String

Status code collected.

id

String

Span ID.

Table 5 DiscardInfo

Parameter

Type

Description

type

String

Type.

count

Integer

Quantity.

totalTime

Long

Total duration.

Example Requests

Obtain all data of trace 16-1666684411910-1326.

/v1/apm2/openapi/view/trace/get-trace-events?trace_id=16-1666684411910-1326

Example Responses

Status code: 200

OK: The request is successful.

{
  "span_event_list" : [ {
    "global_trace_id" : "16-1666684411910-1326",
    "global_path" : null,
    "trace_id" : "16-1666684411910-1326",
    "span_id" : "1",
    "env_id" : 11,
    "instance_id" : 16,
    "app_id" : 11,
    "biz_id" : 162,
    "domain_id" : 1,
    "source" : "/apm2/health/v1/health-check",
    "real_source" : "/apm2/health/v1/health-check",
    "start_time" : 1666684411910,
    "time_used" : 1,
    "code" : 200,
    "class_name" : "org/apache/catalina/core/StandardHostValve",
    "is_async" : false,
    "tags" : { },
    "has_error" : false,
    "error_reasons" : null,
    "type" : "Tomcat",
    "http_method" : "GET",
    "biz_code" : null,
    "event_id" : "1",
    "next_spanId" : null,
    "source_event_id" : null,
    "method" : "invoke",
    "children_event_count" : 0,
    "discard" : [ ],
    "argument" : "(GET)(/apm2/health/v1/health-check)(200)",
    "attachment" : null,
    "host_name" : "apm2-apm-pu-task-6b5bbfc84d-gtrrs",
    "ip_address" : "172.16.3.7",
    "instance_name" : "default",
    "region" : "suzhou-roma-2",
    "env_name" : "suzhou-roma-2",
    "app_name" : "apm-pu-task",
    "indent" : 0,
    "id" : "1+1"
  } ]
}

Status Codes

Status Code

Description

200

OK: The request is successful.

401

Unauthorized: No permissions.

403

Forbidden: Access forbidden.

404

Not Found: The requested resource is not found.

Error Codes

See Error Codes.