use of io.datarouter.storage.client.ClientId in project datarouter by hotpads.
the class SqsUpdateQueueHandler method deleteQueue.
@Handler
private Mav deleteQueue(@Param(PARAM_clientName) String clientName, @Param(PARAM_queueName) String queueName, @Param(PARAM_referer) String referer) {
ClientId clientId = datarouterClients.getClientId(clientName);
AmazonSQS sqs = sqsClientManager.getAmazonSqs(clientId);
GetQueueUrlResult queueUrlResult = sqs.getQueueUrl(queueName);
sqs.deleteQueue(queueUrlResult.getQueueUrl());
String message = "Deleted unreferenced SQS queue: " + queueName;
var dto = new DatarouterChangelogDtoBuilder("Sqs", queueName, "deleteQueue", getSessionInfo().getRequiredSession().getUsername()).build();
changelogRecorder.record(dto);
return buildPage(referer, message);
}
use of io.datarouter.storage.client.ClientId in project datarouter by hotpads.
the class SqsQueuesLengthMonitoringJob method getQueueLengthAndSaveAsMetric.
private void getQueueLengthAndSaveAsMetric(BaseSqsNode<?, ?, ?> baseSqsNode) {
Twin<String> queueUrlAndName = baseSqsNode.getQueueUrlAndName().get();
String queueName = queueUrlAndName.getRight();
ClientId clientId = baseSqsNode.getClientId();
String queueUrl = queueUrlAndName.getLeft();
String queueLengthString = sqsClientManager.getQueueAttribute(clientId, queueUrl, QueueAttributeName.ApproximateNumberOfMessages);
long queueLength = Long.parseLong(queueLengthString);
metrics.saveSqsQueueLength(queueName, queueLength);
}
use of io.datarouter.storage.client.ClientId in project datarouter by hotpads.
the class HBaseCompactionJob method run.
@Override
public void run(TaskTracker tracker) {
for (ClientId clientId : compactionInfo.getManagedClientIds()) {
Admin admin = hBaseClientManager.getAdmin(clientId);
DrServerList servers = new DrServerList(admin);
List<String> tableNames = nodes.getTableNamesForClient(clientId.getName());
for (String tableName : tableNames) {
if (tracker.heartbeat(numRegions.sum()).shouldStop()) {
return;
}
try {
compactTable(tracker, admin, servers, clientId, tableName);
} catch (Exception e) {
logger.warn("error compacting {}.{}", clientId, tableName, e);
}
}
}
logger.warn("numTables={}, numRegions={}, numMissingLoad={}, numAlreadyLocal={}, numTriggered={}", numTables, numRegions, numMissingLoad, numAlreadyLocal, numTriggered);
}
use of io.datarouter.storage.client.ClientId in project datarouter by hotpads.
the class MysqlWebInspector method getC3P0Stats.
private ContainerTag<?> getC3P0Stats(ClientId clientId, DatarouterWebRequestParams<MysqlClientType> clientParams) {
MysqlClientManager clientManager = injector.getInstance(clientParams.getClientType().getClientManagerClass());
Optional<C3p0StatsDto> c3p0Stats = c3p0StatsService.getC3p0Stats().stream().filter(stats -> stats.clientName.equals(clientId.getName())).findAny();
var totalConnections = c3p0Stats.map(stats -> stats.total).map(stats -> stats + "").orElse("");
var busyConnections = c3p0Stats.map(stats -> stats.busy).map(stats -> stats + "").orElse("");
return dl(dt("handles:"), dd(clientManager.getStats(clientId)), dt("total connection:"), dd(totalConnections), dt("busy connection:"), dd(busyConnections));
}
use of io.datarouter.storage.client.ClientId in project datarouter by hotpads.
the class Datarouter method register.
public <PK extends PrimaryKey<PK>, D extends Databean<PK, D>, F extends DatabeanFielder<PK, D>, N extends Node<PK, D, F>> N register(N node) {
nodes.register(node);
for (ClientId clientId : registerClientIds(node.getClientIds())) {
ClientManager clientManager = clients.getClientManager(clientId);
clientManager.doSchemaUpdate(node.getPhysicalNodesForClient(clientId.getName()));
}
return node;
}
Aggregations