文档首页> 应用性能管理 APM> API参考(2.0)> API> VIEW> 获取一个trace的所有调用链数据
更新时间:2024-04-29 GMT+08:00
分享

获取一个trace的所有调用链数据

功能介绍

获取一个trace的所有调用链数据。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

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

表1 Query参数

参数

是否必选

参数类型

描述

trace_id

String

调用链ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

从IAM服务获取的用户Token。

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

span_event_list

Array of SpanEventInfo objects

span event信息列表。

表4 SpanEventInfo

参数

参数类型

描述

env_name

String

环境名称。

app_name

String

组件名称。

indent

Integer

缩进。

region

String

区域。

host_name

String

主机名称。

ip_address

String

ip地址。

instance_name

String

实例名称。

event_id

String

event的ID,在一个具体的span下面event的编号,一般是1-1-2这种格式。

next_spanId

String

产生下一个span的源的eventId。

source_event_id

String

调用方的eventid。

method

String

方法名。

children_event_count

Integer

子event的个数。

discard

Array of DiscardInfo objects

丢弃的子event个数,key是类型。

argument

String

界面展示的参数,每个类型的event自己来实现。

attachment

Map<String,String>

注册信息里面的attachment。

global_trace_id

String

vTraceId,虚拟traceId。

global_path

String

虚拟traceId经过的path路径。

trace_id

String

traceId。

span_id

String

span id。

env_id

Long

环境id。

instance_id

Long

实例id。

app_id

Long

组件id。

biz_id

Long

应用id。

domain_id

Integer

租户id。

source

String

只有是根event也就是span的时候有值。

real_source

String

根event的时候存在,实际调用的url。

start_time

Long

开始时间。

time_used

Long

耗时。

code

Integer

状态码,针对http的调用有效。

class_name

String

类名。

is_async

Boolean

是否异步的event。

tags

Map<String,String>

包含用户自定义参数,header或body体里的内容,httpMethod, bizCode,以及后续可能新增参数。

has_error

Boolean

是否有错误,主要用在span的场景。

error_reasons

String

错误原因。

type

String

类型,mysql,kafka等。

http_method

String

这里的method实际上是tags里面的http_method,只有url监控项才有。

biz_code

String

业务状态码的采集。

id

String

spanId。

表5 DiscardInfo

参数

参数类型

描述

type

String

类型。

count

Integer

数量。

totalTime

Long

总时间。

请求示例

获取trace_id为16-1666684411910-1326的所有调用链数据。

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

响应示例

状态码: 200

OK,请求响应成功。

{
  "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" : "*.*.*.*",
    "instance_name" : "default",
    "region" : "xxx-roma-2",
    "env_name" : "xxx-roma-2",
    "app_name" : "apm-pu-task",
    "indent" : 0,
    "id" : "1+1"
  } ]
}

状态码

状态码

描述

200

OK,请求响应成功。

400

Bad Request,语义或参数有误。

401

Unauthorized,没有权限。

403

Forbidden,禁止访问。

404

Not Found,没有找到要请求的资源。

错误码

请参见错误码

分享:

    相关文档

    相关产品