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


##########
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:
   I agree that including the URL provides little value. 
   
   As for the attribute name, we should keep the `pulsar` prefix in place to 
avoid confusion or clashes with attributes in other namespaces.
   
   I liked @asafm's proposal to split this by a general status (success or 
failure), as this can further be used by other metrics while also adding 
details relating to this particular metric where we can (connect/redirect). I 
think this is an excellent structure to follow going forward.
   
   To reiterate, we'd have a separate histogram record for the following 
attribute sets (ignoring general resource attributes, such as `pulsar.cluster`):
   `pulsar.lookup.response.type=broker,pulsar.response.status=success`
   `pulsar.lookup.response.type=redirect,pulsar.response.status=success`
   `pulsar.response.status=failure`.



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