You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each application should provide metrics for future application monitoring, especially if its expose API endpoints.
The rule
If we expose a particular REST endpoint, this endpoint should be monitored as well, therefore, each method with @Get, @Post, etc. annotations should have annotation @Timed with metric reference.
@Timed is just an example, in the future we'll configure several REST frameworks with different standards for monitoring (e.g micrometer, etc.).
Ruleset(s)
arch4u-micrometer-ruleset.xml (with monitoring related test cases e.g. micrometer @Timed annotation)
arch4u-template-ruleset.xml (with non-monitoring related test cases e.g. any other annotation like @Override)
Test case 1 [positive/right]: Expected annotation is present on the method that has another annotation
@RestControllerpublicclassMyTypicalRestController {
@Timed@GetMapping("/get") // ok, @Timed is present for all methods with annotation @GETpublic .. get(BigIntegerid) {
..
}
@GetMapping("/getXXX") // violation, no annotation @Timed foundpublic .. getXXX(BigIntegerid) {
..
}
}
Test case 2 [positive/right]: Expected annotation is present on the method that has some signature like public Order getXXXX
@RestControllerpublicclassMyTypicalRestController {
@Timed@GetMapping("/get") // ok, @Timed is present for all methods with annotation @GETpublic .. get(BigIntegerid) {
..
}
@GetMapping("/getXXX") // violation, no annotation @Timed found for method `public Order getXXXX`public .. getXXX(BigIntegerid) {
..
}
}
The text was updated successfully, but these errors were encountered:
@dgroup , please describe the second example. why the method with this signature should have @Timed annotation?
in this case, it will be better to split the rule into 2 separate rules - it will be easier to specify property values for each rule separately
in my opinion, methods should have such annotation if the class has @RestController annotation
Overview
Each application should provide metrics for future application monitoring, especially if its expose API endpoints.
The rule
If we expose a particular REST endpoint, this endpoint should be monitored as well, therefore, each method with
@Get
,@Post
, etc. annotations should have annotation@Timed
with metric reference.@Timed
is just an example, in the future we'll configure several REST frameworks with different standards for monitoring (e.g micrometer, etc.).Ruleset(s)
@Timed
annotation)@Override
)Test case 1 [positive/right]: Expected annotation is present on the method that has another annotation
Test case 2 [positive/right]: Expected annotation is present on the method that has some signature like
public Order getXXXX
The text was updated successfully, but these errors were encountered: