-
Hi, I am trying to add Observability info to a method: @GetMapping(value = "/getClient")
public Mono<ResponseEntity<String>> getClient(HttpServletRequest request, final ClientRequest body) {
return myService
.getClient(body.getClient_id(), body.getProvider())
.doOnError(throwable -> log.error("Failed to get client", throwable))
.name("get_client")
.tag("client_id", body.getClient_id())
.tag("provider", body.getProvider())
.tap(Micrometer.observation(observationRegistry));
} This gives me some extra info in my traces and also the metrics; all works fine. But now I also want to know if this call was successful or if it contains an error. For that I would need a mix of .tag(...) and .doOnError(...), but I can't find a solution. I would have the same problem if I wanted to add info about the result of myService.getClient. I this actually possible ? [EDIT] It's a micrometer question, but here is the answer anyway: ...
.doOnError(throwable -> observationRegistry.getCurrentObservation().event(Observation.Event.of("Error", "Whatever"));
.map(result -> observationRegistry.getCurrentObservation().event(Observation.Event.of("Success", "Whatever")
... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This question seems to be about micrometer tracing. You might have better luck asking this in the micrometer tracing project. |
Beta Was this translation helpful? Give feedback.
This question seems to be about micrometer tracing. You might have better luck asking this in the micrometer tracing project.