BewareMyPower commented on code in PR #26163:
URL: https://github.com/apache/pulsar/pull/26163#discussion_r3575705508


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1313,31 +1313,32 @@ public CompletableFuture<Optional<Topic>> 
getTopic(final TopicName topicName, bo
                     context.setProperties(properties);
                 }
                 topicFuture.exceptionally(t -> {
-                    final var now = System.nanoTime();
+                    final var latency = 
context.traceAndGetLatency("fail").description();
                     if (FutureUtil.unwrapCompletionException(t) instanceof 
TimeoutException) {
                         log.warn()
                                 .attr("topic", topicName)
-                                .attr("latencyMs", context.latencyMs(now))
+                                .attr("latency", latency)
                                 .log("Failed to load topic");
                     } else {
                         log.warn()
                                 .attr("topic", topicName)
-                                .attr("latencyMs", context.latencyString(now))
+                                .attr("latency", latency)
                                 .exception(t)
                                 .log("Failed to load topic");
                     }
                     pulsarStats.recordTopicLoadFailed();
                     return Optional.empty();
                 });
-                checkNonPartitionedTopicExists(topicName).thenAccept(exists -> 
{
+                context.trace("topic exists", 
checkNonPartitionedTopicExists(topicName)).thenAccept(exists -> {

Review Comment:
   BTW, tracing a future should not be used here, it should be used in a chain 
call. I will change it to a trivial trace here, as well as some other places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to