我有一个 Spring Boot 微服务,我将 @LoadBalanced 与 Ribbon 一起使用,就像一个魅力。
但现在我正在寻找是否有办法从功能区收集统计数据或指标。
有没有办法以编程方式获取这些信息?
当应用程序启动时,我可以看到如下统计信息:
INFO 13720 --- [main] cnlDynamicServerListLoadBalancer: DynamicServerListLoadBalancer for client client-one initialized: DynamicServerListLoadBalancer: {NFLoadBalancer: name = client-one, current list of Servers = [localhost: 9030, Localhost: 9050, localhost: 9040], Load balancer stats = Zone stats: {defaultzone = [Zone: defaultzone; Instance count: 3; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
}, Server stats: [[Server: localhost: 9030; Zone: defaultZone; Total Requests: 0; Successive connection failure: 0; Total blackout seconds: 0; Last connection made: Wed Dec 31 21:00:00 BRT 1969; First connection made: Wed Dec 31 21:00:00 BRT 1969; Active Connections: 0; Total failure count in last (1000) msecs: 0; Average resp time: 0.0; 90 percentile resp time: 0.0; 95 percentile resp time: 0.0; Min resp time: 0.0; Max resp time: 0.0; Stddev resp time: 0.0]
, [Server: localhost: 9050; Zone: defaultZone; Total Requests: 0; Successive connection failure: 0; Total blackout seconds: 0; Last connection made: Wed Dec 31 21:00:00 BRT 1969; First connection made: Wed Dec 31 21:00:00 BRT 1969; Active Connections: 0; Total failure count in last (1000) msecs: 0; Average resp time: 0.0; 90 percentile resp time: 0.0; 95 percentile resp time: 0.0; Min resp time: 0.0; Max resp time: 0.0; Stddev resp time: 0.0]
, [Server: localhost: 9040; Zone: defaultZone; Total Requests: 0; Successive connection failure: 0; Total blackout seconds: 0; Last connection made: Wed Dec 31 21:00:00 BRT 1969; First connection made: Wed Dec 31 21:00:00 BRT 1969; Active Connections: 0; Total failure count in last (1000) msecs: 0; Average resp time: 0.0; 90 percentile resp time: 0.0; 95 percentile resp time: 0.0; Min resp time: 0.0; Max resp time: 0.0; Stddev resp time: 0.0]