codelipenghui commented on code in PR #22058:
URL: https://github.com/apache/pulsar/pull/22058#discussion_r1510488386


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java:
##########
@@ -175,6 +187,25 @@ public NamespaceService(PulsarService pulsar) {
         this.bundleSplitListeners = new CopyOnWriteArrayList<>();
         this.localBrokerDataCache = 
pulsar.getLocalMetadataStore().getMetadataCache(LocalBrokerData.class);
         this.redirectManager = new RedirectManager(pulsar);
+
+        var meter = pulsar.getOpenTelemetry().getMeter();
+        this.lookupRedirectsCounter = meter
+                .counterBuilder("pulsar.broker.lookup.redirect")
+                .setDescription("The number of lookup redirected requests")
+                .build();
+        this.lookupFailuresCounter = meter
+                .counterBuilder("pulsar.broker.lookup.failure")
+                .setDescription("The number of lookup failures")
+                .build();
+        this.lookupAnswersCounter = meter
+                .counterBuilder("pulsar.broker.lookup.answer")
+                .setDescription("The number of lookup responses (i.e. not 
redirected requests)")
+                .build();
+        this.lookupLatencyHistogram = meter
+                .histogramBuilder("pulsar.broker.lookup.latency")

Review Comment:
   @asafm @dragosvictor 
   
   Both `broker, redirect` connote success. Why do we need to have (broker, 
success), (redirect, success)? For failures, it could be a couple of reason, 
topic not found or some temporary reason (metadata issue), I'm not sure how the 
broker can say the reason is belongs to `redirect` or `broker`. So the response 
type will always be Failed for the failed lookup response.
   
   
https://github.com/apache/pulsar/blob/ccc2ea67c192b4771c9af30c6eaf994fe01958e5/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java#L974-L982
   
   I think the name defined in Pulsar is little confusing. If the name is 
LookupResponseCode, it will be easy to comprehend than LookupType :)
   
   IMO, `broker`, `redirect` and `failure` are just like the HTTP response code 
`200`, `307`, `500`.
   
   Another question about the attribute name. I guess we will have global 
attributes so we must have `pulsar.lookup` as prefix? Is it possible to have 
local attribute for `pulsar.lookup.response.type`? It could only work with some 
metrics related to lookup.



-- 
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