use of com.github.ambry.cloud.azure.AzureMetrics in project ambry by linkedin.
the class CloudBlobStoreIntegrationTest method setup.
@Before
public void setup() throws ReflectiveOperationException {
Properties testProperties = new Properties();
try (InputStream input = this.getClass().getClassLoader().getResourceAsStream(PROPS_FILE_NAME)) {
if (input == null) {
throw new IllegalStateException("Could not find resource: " + PROPS_FILE_NAME);
}
testProperties.load(input);
} catch (IOException ex) {
throw new IllegalStateException("Could not load properties from resource: " + PROPS_FILE_NAME);
}
testProperties.setProperty("clustermap.cluster.name", "Integration-Test");
testProperties.setProperty("clustermap.datacenter.name", "uswest");
testProperties.setProperty("clustermap.host.name", "localhost");
testProperties.setProperty("kms.default.container.key", "B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF");
testProperties.setProperty(CloudConfig.CLOUD_DELETED_BLOB_RETENTION_DAYS, String.valueOf(1));
testProperties.setProperty(AzureCloudConfig.AZURE_PURGE_BATCH_SIZE, "10");
testProperties.setProperty(CloudConfig.CLOUD_IS_VCR, "" + isVcr);
verifiableProperties = new VerifiableProperties(testProperties);
azureCloudConfig = new AzureCloudConfig(verifiableProperties);
ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties);
CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
partitionId = new Partition(666, clusterMapConfig.clusterMapDefaultPartitionClass, PartitionState.READ_WRITE, 100 * 1024 * 1024 * 1024L);
ClusterMap clusterMap = new MockClusterMap(false, Collections.singletonList(new MockDataNodeId(Collections.singletonList(new Port(6666, PortType.PLAINTEXT)), Collections.singletonList("test"), "AzureTest")), 1, Collections.singletonList(partitionId), "AzureTest");
MetricRegistry registry = new MetricRegistry();
vcrMetrics = new VcrMetrics(registry);
azureMetrics = new AzureMetrics(registry);
CloudDestinationFactory cloudDestinationFactory = Utils.getObj(cloudConfig.cloudDestinationFactoryClass, verifiableProperties, registry, clusterMap);
cloudDestination = cloudDestinationFactory.getCloudDestination();
cloudBlobStore = new CloudBlobStore(verifiableProperties, partitionId, cloudDestination, clusterMap, vcrMetrics);
cloudBlobStore.start();
}
use of com.github.ambry.cloud.azure.AzureMetrics in project ambry by linkedin.
the class AzureTokenResetTool method main.
public static void main(String[] args) {
String commandName = AzureTokenResetTool.class.getSimpleName();
try {
VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
String clusterName = verifiableProperties.getString(ClusterMapConfig.CLUSTERMAP_CLUSTER_NAME);
CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
AzureCloudConfig azureCloudConfig = new AzureCloudConfig(verifiableProperties);
AzureMetrics azureMetrics = new AzureMetrics(new MetricRegistry());
AzureBlobLayoutStrategy blobLayoutStrategy = new AzureBlobLayoutStrategy(clusterName, azureCloudConfig);
AzureBlobDataAccessor dataAccessor = new AzureBlobDataAccessor(cloudConfig, azureCloudConfig, blobLayoutStrategy, azureMetrics);
storageClient = dataAccessor.getStorageClient();
int tokensDeleted = resetTokens(clusterName);
logger.info("Deleted tokens for {} partitions", tokensDeleted);
} catch (Exception ex) {
ex.printStackTrace();
logger.error("Command {} failed", commandName, ex);
System.exit(1);
}
}
Aggregations