Skip to content

Commit

Permalink
remove jmx calls metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
skoppu22 committed Dec 5, 2024
1 parent 456caa4 commit 02f1ad8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 106 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,4 @@ public interface ServerMetrics
* @return metrics related to internal caches that are tracked.
*/
CacheMetrics cacheMetrics();

/**
* @return metrics related to invocation of C* JMX operations
*/
JmxOperationsMetrics jmxOperationsMetrics();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class ServerMetricsImpl implements ServerMetrics
protected final RestoreMetrics restoreMetrics;
protected final SchemaMetrics schemaMetrics;
protected final CacheMetrics cacheMetrics;
protected final JmxOperationsMetrics jmxOperationsMetrics;

public ServerMetricsImpl(MetricRegistry metricRegistry)
{
Expand All @@ -44,7 +43,6 @@ public ServerMetricsImpl(MetricRegistry metricRegistry)
this.restoreMetrics = new RestoreMetrics(metricRegistry);
this.schemaMetrics = new SchemaMetrics(metricRegistry);
this.cacheMetrics = new CacheMetrics(metricRegistry);
this.jmxOperationsMetrics = new JmxOperationsMetrics(metricRegistry);
}

@Override
Expand Down Expand Up @@ -76,10 +74,4 @@ public CacheMetrics cacheMetrics()
{
return cacheMetrics;
}

@Override
public JmxOperationsMetrics jmxOperationsMetrics()
{
return jmxOperationsMetrics;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.apache.cassandra.sidecar.common.server.exceptions.JmxAuthenticationException;
import org.apache.cassandra.sidecar.concurrent.ExecutorPools;
import org.apache.cassandra.sidecar.exceptions.NoSuchSidecarInstanceException;
import org.apache.cassandra.sidecar.metrics.JmxOperationsMetrics;
import org.apache.cassandra.sidecar.utils.CassandraInputValidator;
import org.apache.cassandra.sidecar.utils.InstanceMetadataFetcher;

Expand Down Expand Up @@ -344,24 +343,6 @@ protected StorageOperations getStorageOperations(String host)
throw cassandraServiceUnavailable();
}


return storageOperations;
}

protected <V> void updateJmxMetric(AsyncResult<V> result,
JmxOperationsMetrics jmxOperationsMetrics,
String operationName,
long startTime)
{
if (result.succeeded())
{
jmxOperationsMetrics.recordTimeTaken(operationName + "Succeeded",
System.nanoTime() - startTime);
}
else
{
jmxOperationsMetrics.recordTimeTaken(operationName + "Failed",
System.nanoTime() - startTime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.cassandra.sidecar.common.response.GetPreemptiveOpenIntervalResponse;
import org.apache.cassandra.sidecar.common.server.StorageOperations;
import org.apache.cassandra.sidecar.concurrent.ExecutorPools;
import org.apache.cassandra.sidecar.metrics.JmxOperationsMetrics;
import org.apache.cassandra.sidecar.metrics.SidecarMetrics;
import org.apache.cassandra.sidecar.routes.AbstractHandler;
import org.apache.cassandra.sidecar.utils.CassandraInputValidator;
Expand All @@ -40,7 +39,6 @@
@Singleton
public class GetPreemptiveOpenIntervalHandler extends AbstractHandler<Void>
{
private final JmxOperationsMetrics jmxOperationsMetrics;

@Inject
protected GetPreemptiveOpenIntervalHandler(InstanceMetadataFetcher metadataFetcher,
Expand All @@ -49,7 +47,6 @@ protected GetPreemptiveOpenIntervalHandler(InstanceMetadataFetcher metadataFetch
SidecarMetrics sidecarMetrics)
{
super(metadataFetcher, executorPools, validator);
this.jmxOperationsMetrics = sidecarMetrics.server().jmxOperationsMetrics();
}

@Override
Expand All @@ -65,20 +62,13 @@ protected void handleInternal(RoutingContext context,
SocketAddress remoteAddress,
Void request)
{
getSSTablePreemptiveOpenInterval(host, remoteAddress)
.onSuccess(context::json)
.onFailure(cause -> processFailure(cause, context, host, remoteAddress, request));
}

protected Future<GetPreemptiveOpenIntervalResponse> getSSTablePreemptiveOpenInterval(String host, SocketAddress remoteAddress)
{
long startTime = System.nanoTime();
StorageOperations storageOperations = getStorageOperations(host);
logger.debug("Retrieving SSTable's preemptiveOpenInterval, remoteAddress={}, instance={}",
remoteAddress, host);

return executorPools.service()
.executeBlocking(storageOperations::getSSTablePreemptiveOpenIntervalInMB)
.onComplete(ar -> updateJmxMetric(ar, jmxOperationsMetrics, "getSSTablePreemptiveOpenInterval", startTime));
executorPools.service()
.executeBlocking(storageOperations::getSSTablePreemptiveOpenIntervalInMB)
.onSuccess(context::json)
.onFailure(cause -> processFailure(cause, context, host, remoteAddress, request));
}
}

0 comments on commit 02f1ad8

Please sign in to comment.