|
此版本仍在开发中,尚未视为稳定版。如需最新稳定版本,请使用 Spring Boot 4.0.4! |
HTTP 交换(httpexchanges)
httpexchanges 端点提供有关 HTTP 请求-响应交换的信息。
检索 HTTP 交换
要获取 HTTP 交换记录,请向 GET 发起一个 /actuator/httpexchanges 请求,如下方基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/httpexchanges' -i -X GET
生成的响应类似于以下内容:
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" : {
"headers" : {
"Accept" : [ "application/json" ]
},
"method" : "GET",
"uri" : "https://api.example.com"
},
"response" : {
"headers" : {
"Content-Type" : [ "application/json" ]
},
"status" : 200
},
"principal" : {
"name" : "alice"
},
"session" : {
"id" : "ea8ee04f-003f-4244-b55d-0045dddb7d4f"
},
"timeTaken" : "PT0.023S"
} ]
}
响应结构
响应包含所追踪的 HTTP 请求-响应交换的详细信息。 下表描述了响应的结构:
| 路径 | 类型 | <description> </description> |
|---|---|---|
|
|
一组HTTP请求-响应交换。 |
|
|
交换发生的时间戳。 |
|
|
交换的主体(如果有的话)。 |
|
|
主体的名称。 |
|
|
请求的 HTTP 方法。 |
|
|
接收到请求的远程地址(如果已知)。 |
|
|
请求的 URI。 |
|
|
请求的头部信息,以头部名称为键。 |
|
|
请求头的值 |
|
|
响应的状态 |
|
|
响应的头部,以头部名称为键。 |
|
|
请求头的值 |
|
|
与交换关联的会话(如果有的话)。 |
|
|
会话的ID。 |
|
|
处理交换所花费的时间。 |