如何使用千分尺和带有datadatadog的statsd获取所有度量标准,包括状态代码和异常。我正在使用maven依赖于microstat-statsd和spring-boot执行器?
我已经根据弹簧启动执行器的配置向控制器添加了@Timed注释。但是在石墨中,我只看到http.server.requests.max,但没有异常或状态代码。
有人可以指出我缺少什么配置吗?
@RestController
@Timed
@Slf4j
public class accountsController {
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.CREATED)
@Timed(value = "createaccount.timer",percentiles = {0.9,0.99},histogram = true)
@Counted(value = "compass.createaccount.counter")
public accountResponse createaccount(@RequestBody CreateaccountRequest
createaccountRequest){
// Business logic
}
}
@Configuration
@EnableAspectJAutoProxy
public class MetricConfiguration {
@Bean
public TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}
@Bean
public CountedAspect countedAspect(MeterRegistry registry) {
return new CountedAspect(registry);
}
}