yifan-c commented on code in PR #102:
URL: https://github.com/apache/cassandra-sidecar/pull/102#discussion_r1515286558


##########
src/main/dist/conf/sidecar.yaml:
##########
@@ -142,6 +142,15 @@ healthcheck:
   initial_delay_millis: 0
   poll_freq_millis: 30000
 
+metrics:
+  registry_name: cassandra_sidecar
+  vertx:
+    enabled: true
+    registry_name: cassandra_sidecar

Review Comment:
   is it a duplication of the `registry_name` in the outer structure?



##########
src/main/dist/conf/sidecar.yaml:
##########
@@ -142,6 +142,15 @@ healthcheck:
   initial_delay_millis: 0
   poll_freq_millis: 30000
 
+metrics:
+  registry_name: cassandra_sidecar
+  vertx:
+    enabled: true
+    registry_name: cassandra_sidecar
+    jmx_enabled: false
+    jmx_domain_name: sidecar.vertx.jmx_domain
+    monitored_server_routes_regex: /api/v1/*      # all routes are monitored

Review Comment:
   I do not think having a single matcher is sufficient. There are likely use 
cases that exclude some route and add some selectively. 
   It probably need a list of matchers 



##########
src/main/java/org/apache/cassandra/sidecar/metrics/instance/InstanceMetricRegistry.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.sidecar.metrics.instance;
+
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.SharedMetricRegistries;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.cassandra.sidecar.cluster.InstancesConfig;
+import org.apache.cassandra.sidecar.cluster.instance.InstanceMetadata;
+
+/**
+ * A dropwizard {@link MetricRegistry} associated with a specific Cassandra 
instance.
+ */
+public class InstanceMetricRegistry extends MetricRegistry
+{
+    private final int instanceId;
+
+    public InstanceMetricRegistry(int instanceId)
+    {
+        this.instanceId = instanceId;
+    }
+
+    public int instanceId()
+    {
+        return instanceId;
+    }
+
+    /**
+     * A factory for creating instance specific {@link MetricRegistry} 
provided an instance id.
+     */
+    @Singleton
+    public static class Factory

Review Comment:
   The name `Factory` is too general. 



##########
src/main/java/org/apache/cassandra/sidecar/metrics/MetricName.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.sidecar.metrics;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Representation of a metric name.
+ */
+public class MetricName
+{
+    private final String feature;
+    private final  String name;

Review Comment:
   extra space



##########
src/main/java/org/apache/cassandra/sidecar/metrics/MetricName.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.sidecar.metrics;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * Representation of a metric name.
+ */
+public class MetricName
+{
+    private final String feature;
+    private final  String name;
+    private final Set<String> tags;
+
+    public MetricName(String feature, String name)
+    {
+        this(feature, name, Collections.emptySet());
+    }
+
+    public MetricName(String feature, String name, String... tags)
+    {
+        this(feature, name, new HashSet<>(Arrays.asList(tags)));
+    }
+
+    /**
+     * Constructs a new instance of {@link MetricName} with given parameters.
+     *
+     * @param feature feature for which metric is captured
+     * @param name metric name
+     * @param tags additional name tags optionally added to metric name for 
more clarity. Tags are usually like,
+     *             component=data, route=/stream/component, etc.
+     */
+    public MetricName(String feature, String name, Set<String> tags)
+    {
+        this.feature = Objects.requireNonNull(feature, "Feature can not be 
null");
+        this.name = Objects.requireNonNull(name, "Name can not be null");
+        this.tags = tags;
+    }
+
+    /**
+     * Sidecar feature this metric is part of.
+     * @return String
+     */
+    public String feature()
+    {
+        return feature;
+    }
+
+    /**
+     * If applicable, additional name tags added to metric name for more 
clarity. Tags are usually like,
+     * component=data, route=/stream/component, etc.
+     * @return a set containing additional metric name tags
+     */
+    public Set<String> tags()

Review Comment:
   If tag is always in the form of `key=value`, can you have proper data class 
instead of `String`?



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