yifan-c commented on code in PR #111:
URL: https://github.com/apache/cassandra-sidecar/pull/111#discussion_r1566615609
##########
src/main/java/org/apache/cassandra/sidecar/metrics/instance/UploadSSTableMetrics.java:
##########
@@ -33,13 +34,26 @@
*/
public class UploadSSTableMetrics
{
- public static final String DOMAIN = INSTANCE_PREFIX + ".upload_sstable";
+ public static final String DOMAIN = INSTANCE_PREFIX + ".UploadSSTable";
protected final MetricRegistry metricRegistry;
protected final Map<String, UploadSSTableComponentMetrics>
uploadComponentMetrics = new ConcurrentHashMap<>();
+ public final NamedMetric<Meter> totalBytesUploadedRate;
+ public final NamedMetric<DefaultSettableGauge<Integer>> rateLimitedCalls;
Review Comment:
1. how about just rename it to `Throttled`? The same as the metric name.
2. The metric type needs to be `DeltaGauge`. We want to capture the number
of throttled calls between the publishing intervals.
##########
src/main/java/org/apache/cassandra/sidecar/routes/sstableuploads/SSTableImportHandler.java:
##########
@@ -162,18 +164,20 @@ protected SSTableImportRequest
extractParamsOrThrow(RoutingContext context)
* @param importOptions the import options
* @return a future for the import
*/
- private Future<Void> importSSTablesAsync(SSTableImporter.ImportOptions
importOptions)
+ private Future<Void> importSSTablesAsync(SSTableImporter.ImportOptions
importOptions, SSTableImportMetrics metrics)
{
CassandraAdapterDelegate cassandra =
metadataFetcher.delegate(importOptions.host());
if (cassandra == null)
{
+ metrics.cassandraUnavailable.metric.setValue(1);
return Future.failedFuture(cassandraServiceUnavailable());
}
TableOperations tableOperations = cassandra.tableOperations();
if (tableOperations == null)
{
+ metrics.cassandraUnavailable.metric.setValue(1);
Review Comment:
I still think we should use `failedImports` only. But if keeping
`cassandraUnavailable`, I want to call out that the metric value is never set
to 0.
##########
src/main/java/org/apache/cassandra/sidecar/metrics/instance/SSTableImportMetrics.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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 java.util.Objects;
+
+import com.codahale.metrics.DefaultSettableGauge;
+import com.codahale.metrics.MetricRegistry;
+import org.apache.cassandra.sidecar.metrics.NamedMetric;
+
+import static
org.apache.cassandra.sidecar.metrics.instance.InstanceMetrics.INSTANCE_PREFIX;
+
+/**
+ * Tracks metrics during SSTable import operation done in Cassandra instance
+ */
+public class SSTableImportMetrics
+{
+ public static final String DOMAIN = INSTANCE_PREFIX + ".SSTableImport";
+ protected final MetricRegistry metricRegistry;
+ public final NamedMetric<DefaultSettableGauge<Integer>>
cassandraUnavailable;
Review Comment:
When `cassandraUnavailable`, the import fails, which can be classified under
`failedImports`. Can we remove `cassandraUnavailable` from
`SSTableImportMetrics`?
Besides that, `InstanceHealthMetrics` already captures `jmxDown`, which
leads to `cassandraUnavailable` here.
##########
src/main/java/org/apache/cassandra/sidecar/metrics/instance/StreamSSTableMetrics.java:
##########
@@ -34,13 +34,26 @@
*/
public class StreamSSTableMetrics
{
- public static final String DOMAIN = INSTANCE_PREFIX + ".stream_sstable";
+ public static final String DOMAIN = INSTANCE_PREFIX + ".StreamSSTable";
protected final MetricRegistry metricRegistry;
protected final Map<String, StreamSSTableComponentMetrics>
streamComponentMetrics = new ConcurrentHashMap<>();
+ public final NamedMetric<Meter> totalBytesStreamedRate;
+ public final NamedMetric<DefaultSettableGauge<Integer>> rateLimitedCalls;
Review Comment:
same here. Rename and change type to `DeltaGauge`
--
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]