Search in sources :

Example 1 with ConjureTimeLockClientFeedback

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;
}
Also used : HashMap(java.util.HashMap) ConjureTimeLockClientFeedback(com.palantir.timelock.feedback.ConjureTimeLockClientFeedback)

Example 2 with ConjureTimeLockClientFeedback

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);
}
Also used : ConjureTimeLockClientFeedback(com.palantir.timelock.feedback.ConjureTimeLockClientFeedback) Test(org.junit.Test)

Example 3 with ConjureTimeLockClientFeedback

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();
}
Also used : AuthHeader(com.palantir.tokens.auth.AuthHeader) LoggedRequest(com.github.tomakehurst.wiremock.verification.LoggedRequest) ConjureTimeLockClientFeedback(com.palantir.timelock.feedback.ConjureTimeLockClientFeedback) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) AtlasDbRuntimeConfig(com.palantir.atlasdb.config.AtlasDbRuntimeConfig) ImmutableAtlasDbRuntimeConfig(com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)

Aggregations

ConjureTimeLockClientFeedback (com.palantir.timelock.feedback.ConjureTimeLockClientFeedback)3 LoggedRequest (com.github.tomakehurst.wiremock.verification.LoggedRequest)1 ImmutableList (com.google.common.collect.ImmutableList)1 AtlasDbRuntimeConfig (com.palantir.atlasdb.config.AtlasDbRuntimeConfig)1 ImmutableAtlasDbRuntimeConfig (com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)1 AuthHeader (com.palantir.tokens.auth.AuthHeader)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Test (org.junit.Test)1