sarankk commented on code in PR #102:
URL: https://github.com/apache/cassandra-sidecar/pull/102#discussion_r1536078578


##########
src/main/java/org/apache/cassandra/sidecar/cluster/instance/InstanceMetadataImpl.java:
##########
@@ -188,6 +203,29 @@ public Builder delegate(CassandraAdapterDelegate delegate)
             return update(b -> b.delegate = delegate);
         }
 
+        /**
+         * Builds instance specific {@link 
com.codahale.metrics.MetricRegistry} given the global registry name.
+         *
+         * @param registryName global {@link 
com.codahale.metrics.MetricRegistry} name
+         * @return a reference to this Builder
+         */
+        public Builder globalMetricRegistryName(String registryName)
+
+        {
+            Objects.requireNonNull(registryName);
+
+            String instanceRegistryName = instanceRegistryName(registryName);
+            MetricRegistry instanceMetricRegistry = 
SharedMetricRegistries.getOrCreate(instanceRegistryName);
+            InstanceMetricsImpl instanceMetrics = new 
InstanceMetricsImpl(instanceMetricRegistry);
+
+            return update(b -> b.metrics = instanceMetrics);
+        }
+
+        private String instanceRegistryName(String globalRegistryName)
+        {
+            return globalRegistryName + "_" + id;

Review Comment:
   since `id` is an`int`. Same could happen if no id was set before build. 
Maybe we should convert it into an integer and check if set, before setting 
registry



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to