为了账号安全,请及时绑定邮箱和手机立即绑定

Prometheus 计算每天对特定 Spring 控制器端点的请求

Prometheus 计算每天对特定 Spring 控制器端点的请求

万千封印 2024-01-28 15:58:24
如何查看特定控制器端点在一天或 x 时间段内收到的点击次数。我有一个非常基本的演示应用程序。我的控制器看起来像这样。@RestController@RequestMapping("/person")@RequiredArgsConstructorpublic class PersonController {  private final PersonService personService;  @GetMapping(path = "all")  public List<Person> getAllPerson() {    return personService.getAllPersons();  }  // etc我已经配置了 prometheus 并让它运行。正如您所看到的,我有一个显示总回日志事件的图表。http://localhost:8080/person/all如果想要显示 GET命中的 次数,查询会是什么样子。
查看完整描述

1 回答

?
FFIVE

TA贡献1797条经验 获得超6个赞

http_server_requests_seconds_count或http_server_requests_seconds_sum指标将包含所需的详细信息。


例如,


http_server_requests_seconds_count{application="xyz",exception="None",method="GET",status="200",uri="/admin/info",} 94078.0

http_server_requests_seconds_sum{application="xyz",exception="None",method="GET",status="200",uri="/admin/info",} 96.108260294

提示:如果启用了prometheus管理端点,可以在以下位置查看prometheus指标http://example.com/{actuator|admin}/prometheus


查看完整回答
反对 回复 2024-01-28
  • 1 回答
  • 0 关注
  • 25 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信