You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/07/16 10:28:47 UTC

[flink] branch release-1.9 updated: [FLINK-13104][metrics][datadog] Log all failed requests

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.9
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.9 by this push:
     new 8d032ff  [FLINK-13104][metrics][datadog] Log all failed requests
8d032ff is described below

commit 8d032ffdea359e114b3a6d60ec35859b5cac6aac
Author: mans2singh <ma...@users.noreply.github.com>
AuthorDate: Tue Jul 16 06:28:08 2019 -0400

    [FLINK-13104][metrics][datadog] Log all failed requests
---
 .../org/apache/flink/metrics/datadog/DatadogHttpClient.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpClient.java b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpClient.java
index b9772a3..b5142d5 100644
--- a/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpClient.java
+++ b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpClient.java
@@ -119,7 +119,11 @@ public class DatadogHttpClient {
 		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() {
@@ -128,11 +132,15 @@ public class DatadogHttpClient {
 
 		@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();
 		}
 	}