記錄 HTTP 交換
您可以透過在應用程式配置中提供一個型別為 HttpExchangeRepository 的 bean 來啟用 HTTP 交換記錄。為方便起見,Spring Boot 提供了 InMemoryHttpExchangeRepository,它預設儲存最近 100 個請求-響應交換。與追蹤解決方案相比,InMemoryHttpExchangeRepository 功能有限,我們建議僅將其用於開發環境。對於生產環境,我們建議使用生產級的追蹤或可觀察性解決方案,例如 Zipkin 或 OpenTelemetry。另外,您也可以建立自己的 HttpExchangeRepository。
您可以使用 httpexchanges 端點來獲取儲存在 HttpExchangeRepository 中的請求-響應交換資訊。