java rest集合参数_java – Spring Boot REST API的度量标准集合

您可以使用Spring Boot /actuator/metrics/http.server.requests来获取所有以其计数,异常,结果,状态,总时间等执行的endPoints,如下所示.

如果您想查看特定endPoint的详细信息,那么您可以通过调用请求来执行此操作,如下所示

localhost:8889/actuator/metrics/http.server.requests?tag=uri:

localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets

localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets&tag=status:200

>您将获得COUNT作为特定endPoint的次数

>您将获得COUNT作为特定endPoint的次数

使用特定状态调用

>要获得执行endPoint的平均时间,您可以这样做

特定端点以及整体的TOTAL_TIME / COUNT

应用

本地主机:8889 /致动器/度量/ http.server.requests

{

"name": "http.server.requests",

"description": null,

"baseUnit": "seconds",

"measurements": [

{

"statistic": "COUNT",

"value": 3

},

{

"statistic": "TOTAL_TIME",

"value": 0.21817219999999998

},

{

"statistic": "MAX",

"value": 0.1379249

}

],

"availableTags": [

{

"tag": "exception",

"values": [

"MethodArgumentTypeMismatchException",

"None"

]

},

{

"tag": "method",

"values": [

"GET"

]

},

{

"tag": "uri",

"values": [

"/{id}.*",

"/user/asset/getAsset/{assetId}",

"/user/asset/getAllAssets"

]

},

{

"tag": "outcome",

"values": [

"CLIENT_ERROR",

"SUCCESS"

]

},

{

"tag": "status",

"values": [

"400",

"404",

"200"

]

}

]

}

本地主机:8889 /致动器/度量/ http.server.requests标签= URI:/用户/资产/ getAllAssets

{

"name": "http.server.requests",

"description": null,

"baseUnit": "seconds",

"measurements": [

{

"statistic": "COUNT",

"value": 1

},

{

"statistic": "TOTAL_TIME",

"value": 0.1379249

},

{

"statistic": "MAX",

"value": 0

}

],

"availableTags": [

{

"tag": "exception",

"values": [

"None"

]

},

{

"tag": "method",

"values": [

"GET"

]

},

{

"tag": "outcome",

"values": [

"SUCCESS"

]

},

{

"tag": "status",

"values": [

"200"

]

}

]

}

UPDATE

另一种方法是使用Spring Boot Admin.为此,我们必须配置客户端 – 服务器.为避免错误,请确保客户端 – 服务器依赖关系的版本相同.我们可以从下拉列表中添加所需的指标,如图所示.

客户端:

的pom.xml

de.codecentric

spring-boot-admin-starter-client

2.1.4

application.properties

spring.boot.admin.api-path=/instances

spring.boot.admin.client.url=http://localhost:6699

management.endpoints.web.exposure.include=*

服务器端:

application.properties

server.port = 6699

spring.boot.admin.server.url=http://localhost:8889

的pom.xml

de.codecentric

spring-boot-admin-starter-server

2.1.4

添加@EnableAdminServer

import de.codecentric.boot.admin.server.config.EnableAdminServer;

@SpringBootApplication

@EnableAdminServer

public class AdminApplication {

public static void main(String[] args) {

SpringApplication.run(AdminApplication.class, args);

}

}

主页

a5ebed036450583e490eb26174120bc8.png

度量

589a6c02e5dc0989b8a137063c584f84.png

健康

ycIcs.png

图表

7ee3ccf46880c3a8c0fbf3a6a9255d2e.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值