sách gpt4 ai đã đi

spring - 如何让微米普罗米修斯指标适用于 Flux?

In lại 作者:行者123 更新时间:2023-12-02 09:34:14 hai mươi bốn 4
mua khóa gpt4 Nike

Spring Framework 5.0.1.RELEASESpring Boot 2.0.0.M6 我们希望使用 micrometer application monitoring ,所以 wie 包括:

compile('org.springframework.boot:spring-boot-starter-actuator')
compile('io.micrometer:micrometer-registry-prometheus')

进入我们的依赖项集并创建一个具有以下剩余端点的 Controller :

@Bộ điều khiển nghỉ ngơi
@Timed
public class MyController {

@Autowired
private MyService service;

@RequestMapping(value = "/test", method = RequestMethod.GET)
public void test() {
thử {
Thread.sleep(2000);
} bắt (InterruptedException e) {
e.printStackTrace();
}
}

@RequestMapping(value = "/test/flux", method = RequestMethod.GET, produces = "application/stream+json")
public Flux getMyItems(@RequestParam Map params) {
return this.service.getMyItems(params);
}
}

因此,我们得到了只等待两秒钟的 /test 端点,并且得到了返回项目列表的 /test/flux 端点。

机器人请求工作。唯一的区别是,对于 /test 端点,我获得了 prometheus 指标,而对于 /test/flux 端点,我没有获得任何指标:

http_server_requests_duration_seconds_count{exception="None",method="GET",status="200",uri="/get/test",} 1.0
http_server_requests_duration_seconds_sum{exception="None",method="GET",status="200",uri="/get/test",} 2.002811046
http_server_requests_duration_seconds_max{exception="None",method="GET",status="200",uri="/get/test",} 0.0

我是否必须配置其他内容才能使其适用于返回 Flux 或尚不支持 Flux 的请求?

1 Câu trả lời

Boot 2 RC2 中包含 WebFlux 端点的自动配置!

关于spring - 如何让微米普罗米修斯指标适用于 Flux?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47413062/

hai mươi bốn 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com