Skip to content

Commit

Permalink
[FLINK-13104][metrics][datadog] Log all failed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mans2singh authored and zentol committed Jul 16, 2019
1 parent b610ced commit 2ee200f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ public void close() {
client.connectionPool().evictAll();
}

private static class EmptyCallback implements Callback {
/**
* A handler for OkHttpClient callback. In case of error or failure it logs the error at warning level.
*/
protected static class EmptyCallback implements Callback {

private static final EmptyCallback singleton = new EmptyCallback();

public static Callback getEmptyCallback() {
Expand All @@ -128,11 +132,15 @@ public static Callback getEmptyCallback() {

@Override
public void onFailure(Call call, IOException e) {
LOGGER.debug("Failed sending request to Datadog" , e);
LOGGER.warn("Failed sending request to Datadog", e);
}

@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
LOGGER.warn("Failed to send request to Datadog (response was {})", response);
}

response.close();
}
}
Expand Down

0 comments on commit 2ee200f

Please sign in to comment.