use of com.palantir.timelock.feedback.ConjureTimeLockClientFeedback in project atlasdb by palantir.
the class FeedbackHandler method organizeFeedbackReportsByService.
private Map<String, ServiceFeedback> organizeFeedbackReportsByService(List<ConjureTimeLockClientFeedback> trackedFeedbackReports) {
Map<String, ServiceFeedback> serviceWiseOrganizedFeedback = new HashMap<>();
for (ConjureTimeLockClientFeedback feedback : trackedFeedbackReports) {
ServiceFeedback feedbackForService = serviceWiseOrganizedFeedback.computeIfAbsent(feedback.getServiceName(), service -> new ServiceFeedback());
feedbackForService.addFeedbackForNode(feedback.getNodeId(), feedback);
}
return serviceWiseOrganizedFeedback;
}
use of com.palantir.timelock.feedback.ConjureTimeLockClientFeedback in project atlasdb by palantir.
the class FeedbackAnalysisTest method isAbleToHandleReportsWhereLeaderTimeAndStartTransactionAreEqual.
@Test
public void isAbleToHandleReportsWhereLeaderTimeAndStartTransactionAreEqual() {
FeedbackHandler feedbackHandler = FeedbackHandler.createForTests();
ConjureTimeLockClientFeedback report = getClientFeedbackReport(CLIENT, UUID.randomUUID(), 0, 0, 0, 0);
assertThat(feedbackHandler.pointFeedbackHealthStatus(report)).isEqualTo(HealthStatus.UNKNOWN);
}
use of com.palantir.timelock.feedback.ConjureTimeLockClientFeedback in project atlasdb by palantir.
the class TransactionManagersTest method verifyFeedbackIsReportedToService.
private void verifyFeedbackIsReportedToService() {
AuthHeader authHeader = AuthHeader.valueOf("Bearer omitted");
SettableRefreshable<AtlasDbRuntimeConfig> refreshableRuntimeConfig = Refreshable.create(mockAtlasDbRuntimeConfig);
Refreshable<List<TimeLockClientFeedbackService>> timeLockClientFeedbackServices = TransactionManagers.getTimeLockClientFeedbackServices(config, refreshableRuntimeConfig, USER_AGENT, DialogueClients.create(Refreshable.only(ServicesConfigBlock.builder().build())));
ConjureTimeLockClientFeedback feedbackReport = ConjureTimeLockClientFeedback.builder().atlasVersion("1.0").serviceName("service").nodeId(UUID.randomUUID()).build();
assertThat(timeLockClientFeedbackServices.current()).hasSize(1);
timeLockClientFeedbackServices.current().get(0).reportFeedback(authHeader, feedbackReport);
List<LoggedRequest> requests = findAll(postRequestedFor(urlMatching(FEEDBACK_PATH)));
assertThat(requests).hasSize(1);
availableServer.verify(postRequestedFor(urlMatching(FEEDBACK_PATH)).withHeader("Authorization", containing("Bearer omitted")));
/* config with no servers */
timeLockRuntimeConfig = getTimelockRuntimeConfig(ImmutableList.of());
mockAtlasDbRuntimeConfig = mock(AtlasDbRuntimeConfig.class);
when(mockAtlasDbRuntimeConfig.timelockRuntime()).thenReturn(Optional.of(timeLockRuntimeConfig));
refreshableRuntimeConfig.update(mockAtlasDbRuntimeConfig);
assertThat(timeLockClientFeedbackServices.current()).isEmpty();
}
Aggregations