Reputation: 2911
I am using @Timed
annotation in SpringBoot application to monitor a method. I also want to know the count of response per status.
@GetMapping("/status/{productNumber}", produces = [MediaType.APPLICATION_JSON_VALUE])
@Timed(value = "status.productnumber", description = "Timed information retrieveProduct()")
fun retrieveProduct(@PathVariable productNumber: String): ResponseEntity {
When I open http://localhost:8080/actuator/metrics/status.productnumber I see:
{
"name": "status.productnumber",
"description": "Timed information retrieveProduct()",
"base_unit": "seconds",
"measurements": [
{
"statistic": "COUNT",
"value": 3.0
},
{
"statistic": "TOTAL_TIME",
"value": 0.515840608
},
{
"statistic": "MAX",
"value": 0.006641343
}
],
"available_tags": [
{
"tag": "exception",
"values": [
"None",
"RuntimeException"
]
},
{
"tag": "method",
"values": [
"GET"
]
},
{
"tag": "uri",
"values": [
"/status/{productNumber}"
]
},
{
"tag": "outcome",
"values": [
"SERVER_ERROR",
"SUCCESS"
]
},
{
"tag": "status",
"values": [
"500",
"200"
]
}
]
}
Here the COUNT
statistic shows the total number of times this endpoint or method is accessed. Can I know the count per status? I want to know how many times 500 status code has occurred
Upvotes: 2
Views: 3019
Reputation: 6863
You can query the tags this way: /actuator/metrics/status.productnumber?tag=status:500
, please see the docs.
A couple of side notes:
status.productnumber
by reading its nameUpvotes: 3