更新时间:2024-03-22 GMT+08:00

查询服务事件日志

功能介绍

查询服务事件日志,包含服务的操作记录及部署过程中的关键动作、部署失败原因。

调试

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

URI

GET /v1/{project_id}/services/{service_id}/events

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

用户项目ID。获取方法请参见获取项目ID和名称

service_id

String

服务ID。

表2 Query参数

参数

是否必选

参数类型

描述

event_type

String

事件类型,取值为:

  • normal:正常事件。

  • abnormal:异常事件。

start_time

Number

过滤事件发生时间的起始时间,默认不过滤。

end_time

Number

过滤事件发生时间的截止时间,默认不过滤。

offset

Integer

分页列表的起始页,默认为0。

limit

Integer

指定每一页返回的最大条目数,默认为1000。

sort_by

String

指定排序字段,默认为occur_time(事件产生时间)。

order

String

排序方式,可选值如下:

  • asc : 递增排序

  • desc: 递减排序,默认值

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

service_name

String

服务名称。

total_count

Integer

不分页的情况下符合查询条件的事件总数量。

service_id

String

服务ID。

count

Integer

当前查询结果的事件数量。

events

Array of Events objects

服务的事件日志。

表5 Events

参数

参数类型

描述

event_type

String

事件类型,取值为:

  • normal:正常事件

  • abnormal:异常事件

event_info

String

事件信息,当前主要描述部署过程5个阶段的信息,后续可根据情况继续补充。这5个阶段分别是构建镜像、准备环境、调度资源、拉取镜像、启动模型。

occur_time

Number

事件发生时间,距“1970.1.1 0:0:0 UTC”的毫秒数。

请求示例

GET https://{endpoint}/v1/{project_id}/services/{service_id}/events

响应示例

状态码: 200

服务事件日志。

{
  "service_name" : "service-07085",
  "total_count" : 9,
  "service_id" : "35de3ca9-1bca-4ae7-9cb0-914f30fa7d3e",
  "count" : 9,
  "events" : [ {
    "event_type" : "normal",
    "event_info" : "start to deploy service",
    "occur_time" : 1562597251764
  }, {
    "event_type" : "normal",
    "event_info" : "building image for model [TF 3.0.0]",
    "occur_time" : 1562597251788
  }, {
    "event_type" : "normal",
    "event_info" : "model (TF 3.0.0) build image success",
    "occur_time" : 1562597251805
  }, {
    "event_type" : "normal",
    "event_info" : "preparing environment",
    "occur_time" : 1562597255744
  }, {
    "event_type" : "normal",
    "event_info" : "[TF 3.0.0] prepare environment success",
    "occur_time" : 1562597275915
  }, {
    "event_type" : "normal",
    "event_info" : "[TF 3.0.0] schedule resource success",
    "occur_time" : 1562597275921
  }, {
    "event_type" : "normal",
    "event_info" : "[TF 3.0.0] pulling model image",
    "occur_time" : 1562597275928
  }, {
    "event_type" : "normal",
    "event_info" : "[TF 3.0.0] pull image success",
    "occur_time" : 1562597332570
  }, {
    "event_type" : "normal",
    "event_info" : "[TF 3.0.0] starting model",
    "occur_time" : 1562597332582
  } ]
}

状态码

状态码

描述

200

服务事件日志。

错误码

请参见错误码