Skip to content

Commit

Permalink
use HTTPHealthCheck instead of custom impl doing the same thing
Browse files Browse the repository at this point in the history
  • Loading branch information
awildturtok committed Jun 7, 2023
1 parent eb18de5 commit 56924de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.bakdata.conquery.models.datasets.Dataset;
import com.codahale.metrics.health.HealthCheck;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.dropwizard.health.check.http.HttpHealthCheck;
import lombok.extern.slf4j.Slf4j;

@Slf4j
Expand Down Expand Up @@ -96,7 +97,8 @@ public ExternalTaskState postForm(ExternalForm form, User originalUser, User ser
.header(HTTP_HEADER_CQ_AUTHENTICATION, serviceUserToken)
.header(HTTP_HEADER_CQ_AUTHENTICATION_ORIGINAL, originalUserToken);

return request.post(Entity.entity(form, MediaType.APPLICATION_JSON_TYPE), ExternalTaskState.class);
ExternalTaskState post = request.post(Entity.entity(form.getExternalApiPayload(), MediaType.APPLICATION_JSON_TYPE), ExternalTaskState.class);
return post;
}

public ExternalTaskState getFormState(UUID externalId) {
Expand All @@ -113,14 +115,10 @@ public Response getResult(final URI resultURL) {

}

public HealthCheck.Result checkHealth() {
log.trace("Checking health from: {}", getHealthTarget);
try {
getHealthTarget.request(MediaType.APPLICATION_JSON_TYPE).get(Void.class);
return HealthCheck.Result.healthy();
}
catch (Exception e) {
return HealthCheck.Result.unhealthy(e.getMessage());
}
public HealthCheck createHealthCheck() {
return new HttpHealthCheck(
getHealthTarget.getUri().toString(), client
);
}

}

This file was deleted.

0 comments on commit 56924de

Please sign in to comment.