我需要计算每个端点上的视图。我们的想法是为所有端点创建一个通用的请求计数映射,该映射应基于动态输入的终结点返回视图计数。
假设有人想要检查 的视图计数。http://localhost:8080/user/101
请求映射path = /admin/count & RequestParam = url (Here
/user/101)
然后创建dynamic Request based on RequestParam
http://localhost:8080/actuator/metrics/http.server.requests?tag=uri:/user/101
Get and Return the Response
的动态请求并获取的值(JSON Object)
COUNT
我坚持如何发送一个到 http://localhost:8080/actuator/metrics/http.server.requests?tag=uri:/user/101 并返回它的响应并获取计数值
dynamic request
@RequestMapping(path="/admin/count",method=RequestMethod.POST)
public JSONObject count(@RequestParam(name="url") final String url)//@PathVariable(name="url") final String url
{
String finalURL = "http://localhost:8080/actuator/metrics/http.server.requests?tag=uri:" + url + "";
return sendRequestToURL(finalURL);
}
@RequestMapping(path="/{finalURL}",method=RequestMethod.GET)
public JSONObject sendRequestToURL(@PathVariable("finalURL") String url)
{
//How to return the response Here
}
这就是我在直接触发URL时得到的
获取: http://localhost:8080/actuator/metrics/http.server.requests?tag=uri:/user/101
宝慕林4294392
杨魅力
相关分类