跳到主要内容

HTTP 交换 (httpexchanges)

DeepSeek V3 中英对照 HTTP Exchanges (httpexchanges)

httpexchanges 端点提供了关于 HTTP 请求-响应交换的信息。

检索 HTTP 交换记录

要检索 HTTP 交换记录,请向 /actuator/httpexchanges 发送一个 GET 请求,如下面基于 curl 的示例所示:

$ curl 'http://localhost:8080/actuator/httpexchanges' -i -X GET
bash

生成的响应类似于以下内容:

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 511

{
"exchanges" : [ {
"timestamp" : "2022-12-22T13:43:41Z",
"request" : {
"uri" : "https://api.example.com",
"method" : "GET",
"headers" : {
"Accept" : [ "application/json" ]
}
},
"response" : {
"status" : 200,
"headers" : {
"Content-Type" : [ "application/json" ]
}
},
"principal" : {
"name" : "alice"
},
"session" : {
"id" : "02778209-bfce-4e93-9ea1-17bda59aaf34"
},
"timeTaken" : "PT0.023S"
} ]
}
http

响应结构

响应中包含了跟踪的 HTTP 请求-响应交换的详细信息。下表描述了响应的结构:

路径类型描述
exchangesArrayHTTP 请求-响应交换的数组。
exchanges.[].timestampString交换发生的时间戳。
exchanges.[].principalObject交换的主体(如果有)。
exchanges.[].principal.nameString主体的名称。
exchanges.[].request.methodString请求的 HTTP 方法。
exchanges.[].request.remoteAddressString接收到请求的远程地址(如果已知)。
exchanges.[].request.uriString请求的 URI。
exchanges.[].request.headersObject请求的头部,按头部名称键控。
exchanges.[].request.headers.*.[]Array头部的值
exchanges.[].response.statusNumber响应的状态
exchanges.[].response.headersObject响应的头部,按头部名称键控。
exchanges.[].response.headers.*.[]Array头部的值
exchanges.[].sessionObject与交换关联的会话(如果有)。
exchanges.[].session.idString会话的 ID。
exchanges.[].timeTakenString处理交换所花费的时间。