in server/src/main/java/org/apache/cassandra/sidecar/modules/ConfigurationModule.java [204:252]
private static InstanceMetadata buildInstanceMetadata(Vertx vertx,
InstanceConfiguration cassandraInstance,
CassandraVersionProvider versionProvider,
String sidecarVersion,
JmxConfiguration jmxConfiguration,
CQLSessionProvider session,
DriverUtils driverUtils,
MetricRegistryFactory registryFactory)
{
// TODO: relocate the method to somewhere testable
String host = cassandraInstance.host();
int port = cassandraInstance.port();
JmxClient jmxClient = JmxClient.builder()
.host(cassandraInstance.jmxHost())
.port(cassandraInstance.jmxPort())
.role(cassandraInstance.jmxRole())
.password(cassandraInstance.jmxRolePassword())
.enableSsl(cassandraInstance.jmxSslEnabled())
.connectionMaxRetries(jmxConfiguration.maxRetries())
.connectionRetryDelay(jmxConfiguration.retryDelay())
.build();
MetricRegistry instanceSpecificRegistry = registryFactory.getOrCreate(cassandraInstance.id());
CassandraAdapterDelegate delegate = new CassandraAdapterDelegate(vertx,
cassandraInstance.id(),
versionProvider,
session,
jmxClient,
driverUtils,
sidecarVersion,
host,
port,
new InstanceHealthMetrics(instanceSpecificRegistry));
return InstanceMetadataImpl.builder()
.id(cassandraInstance.id())
.host(host)
.port(port)
.storageDir(cassandraInstance.storageDir())
.dataDirs(cassandraInstance.dataDirs())
.stagingDir(cassandraInstance.stagingDir())
.cdcDir(cassandraInstance.cdcDir())
.commitlogDir(cassandraInstance.commitlogDir())
.hintsDir(cassandraInstance.hintsDir())
.savedCachesDir(cassandraInstance.savedCachesDir())
.localSystemDataFileDir(cassandraInstance.localSystemDataFileDir())
.delegate(delegate)
.metricRegistry(instanceSpecificRegistry)
.build();
}