feat: generate and log new request-id for outbound HTTP calls in WeatherTool
This commit is contained in:
@@ -64,15 +64,20 @@ public class WeatherToolService extends AbstractMcpToolService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
String newRequestId = java.util.UUID.randomUUID().toString();
|
||||||
String url = String.format("https://api.open-meteo.com/v1/forecast?latitude=%f&longitude=%f¤t_weather=true", lat, lon);
|
String url = String.format("https://api.open-meteo.com/v1/forecast?latitude=%f&longitude=%f¤t_weather=true", lat, lon);
|
||||||
|
|
||||||
|
log.info("[WeatherTool] OUTBOUND HTTP IN - request-id: {}", newRequestId);
|
||||||
log.info("[WeatherTool] 날씨 조회 요청 URL: {}", url);
|
log.info("[WeatherTool] 날씨 조회 요청 URL: {}", url);
|
||||||
|
|
||||||
String responseStr = restClient.get()
|
String responseStr = restClient.get()
|
||||||
.uri(url)
|
.uri(url)
|
||||||
|
.header("request-id", newRequestId)
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.body(String.class);
|
.body(String.class);
|
||||||
|
|
||||||
|
log.info("[WeatherTool] OUTBOUND HTTP OUT - request-id: {}", newRequestId);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
JsonNode response = mapper.readTree(responseStr);
|
JsonNode response = mapper.readTree(responseStr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user