Verwenden von Spring WebFlux und Micrometer, ich möchte ein Histogramm der Zeit für eine Methodenausführung erhalten. Nun.
Code: Select all
@RestController
class QuestionController {
MeterRegistry meterRegistry;
Timer responseTime;
public QuestionController(MeterRegistry meterRegistry) {
this.meterRegistry = meterRegistry;
this.responseTime = Timer
.builder("solutionone")
.publishPercentiles(new double[] { 0.5, 0.75, 0.95, 0.99 })
.serviceLevelObjectives(Duration.ofMillis(1000), Duration.ofMillis(2000), Duration.ofMillis(3000), Duration.ofMillis(4000))
.maximumExpectedValue(Duration.ofMillis(6000))
.register(this.meterRegistry);
}
@GetMapping("/question")
Mono question(@RequestParam(value = "id", required = true) int id) {
return Mono.just(id)
.map(oneId -> {
Timer.Sample sample = Timer.start(meterRegistry);
String result = func(oneId); //func will be shown later, but imagine anything you want to measure
sample.stop(responseTime);
return result;
})
;
}

It seems that:
I lost my "buckets" I would like to see the