use of io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder in project datarouter by hotpads.
the class TableCountHandler method deleteRowSamples.
@Handler
private Mav deleteRowSamples(String clientName, String tableName) {
// delete rows from TableSample
var tableSampleKeyPrefix = new TableSampleKey(clientName, tableName, null, null);
tableSampleDao.deleteWithPrefix(tableSampleKeyPrefix);
var dto = new DatarouterChangelogDtoBuilder("Nodewatch", clientName + "." + tableName, "deleted row samples", getSessionInfo().getNonEmptyUsernameOrElse("")).build();
changelogRecorder.record(dto);
return new InContextRedirectMav(request, paths.datarouter.nodewatch.tableCount.toSlashedString());
}
use of io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder in project datarouter by hotpads.
the class TableCountHandler method resample.
@Handler
private Mav resample(String clientName, String tableName) {
var node = (PhysicalSortedStorageReaderNode<?, ?, ?>) nodes.getPhysicalNodeForClientAndTable(clientName, tableName);
tableSpanSamplerJobletCreatorFactory.create(node, tableSamplerService.getSampleInterval(node), tableSamplerService.getBatchSize(node), true, true, System.currentTimeMillis()).createJoblets();
var dto = new DatarouterChangelogDtoBuilder("Nodewatch", clientName + "." + tableName, "resample", getSessionInfo().getNonEmptyUsernameOrElse("")).build();
changelogRecorder.record(dto);
return new InContextRedirectMav(request, paths.datarouter.nodewatch.tableCount.toSlashedString() + "?submitAction=singleTable&clientName=" + clientName + "&tableName=" + tableName);
}
use of io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder in project datarouter by hotpads.
the class DatarouterUserHistoryService method putAndRecordEdit.
public void putAndRecordEdit(DatarouterUser user, DatarouterUser editor, String changes, String signinUrl) {
var history = new DatarouterUserHistory(user.getId(), Instant.now(), editor.getId(), DatarouterUserChangeType.EDIT, changes);
doPutAndRecordEdit(user, history);
sendRoleEditEmail(user, history, signinUrl);
DatarouterChangelogDto dto = new DatarouterChangelogDtoBuilder(CHANGELOG_TYPE, user.getUsername(), DatarouterUserChangeType.EDIT.getPersistentString(), editor.getUsername()).withComment(changes).build();
changelogRecorder.record(dto);
}
use of io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder in project datarouter by hotpads.
the class DatarouterUserHistoryService method putAndRecordPasswordChange.
public void putAndRecordPasswordChange(DatarouterUser user, DatarouterUser editor, String signinUrl) {
var history = new DatarouterUserHistory(user.getId(), Instant.now(), editor.getId(), DatarouterUserChangeType.RESET, "password");
doPutAndRecordEdit(user, history);
sendPasswordChangeEmail(user, history, signinUrl);
DatarouterChangelogDto dto = new DatarouterChangelogDtoBuilder(CHANGELOG_TYPE, user.getUsername(), DatarouterUserChangeType.RESET.getPersistentString(), editor.getUsername()).build();
changelogRecorder.record(dto);
}
use of io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder in project datarouter by hotpads.
the class JobStopperService method stopLocalJob.
// TODO licenses
private void stopLocalJob(String jobClassString, String username, Instant jobTriggerDeadline) {
Class<? extends BaseJob> jobClass = BaseJob.parseClass(jobClassString);
JobWrapper jobWrapper = localTriggerLockService.getForClass(jobClass);
// job isn't running anymore
if (jobWrapper == null) {
return;
}
// the currently running job is not the one that the request was for
if (jobWrapper.triggerTime.isAfter(jobTriggerDeadline)) {
return;
}
jobWrapper.requestStop();
// wait for job to gracefully stop itself
ThreadTool.sleepUnchecked(JobScheduler.JOB_STOP_GRACE_PERIOD_MS);
Future<Void> future = jobWrapper.getFuture();
if (!future.isDone()) {
future.cancel(true);
}
changelogRecorder.record(new DatarouterChangelogDtoBuilder("Job", jobClassString, "interrupt", username).build());
}
Aggregations