Skip to content

Commit a5be823

Browse files
committed
Don't send IO failures to telemetry logs
1 parent fef9d16 commit a5be823

File tree

1 file changed

+17
-6
lines changed
  • internal-api/src/main/java/datadog/trace/relocate/api

1 file changed

+17
-6
lines changed

internal-api/src/main/java/datadog/trace/relocate/api/IOLogger.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package datadog.trace.relocate.api;
22

3+
import static datadog.trace.api.telemetry.LogCollector.EXCLUDE_TELEMETRY;
4+
35
import java.util.concurrent.TimeUnit;
46
import org.slf4j.Logger;
57

@@ -24,14 +26,14 @@ public IOLogger(final Logger log) {
2426
*/
2527
public boolean success(final String format, final Object... arguments) {
2628
if (log.isDebugEnabled()) {
27-
log.debug(format, arguments);
29+
log.debug(EXCLUDE_TELEMETRY, format, arguments);
2830
return true;
2931
}
3032

3133
if (this.logNextSuccess) {
3234
this.logNextSuccess = false;
3335
if (log.isInfoEnabled()) {
34-
log.info(format, arguments);
36+
log.info(EXCLUDE_TELEMETRY, format, arguments);
3537
return true;
3638
}
3739
}
@@ -67,29 +69,38 @@ public boolean error(final String message, Response response, Exception exceptio
6769
if (log.isDebugEnabled()) {
6870
if (response != null) {
6971
log.debug(
72+
EXCLUDE_TELEMETRY,
7073
"{} Status: {}, Response: {}, Body: {}",
7174
message,
7275
response.getStatusCode(),
7376
response.getMessage(),
7477
response.getBody());
7578
} else if (exception != null) {
76-
log.debug(message, exception);
79+
log.debug(EXCLUDE_TELEMETRY, message, exception);
7780
} else {
78-
log.debug(message);
81+
log.debug(EXCLUDE_TELEMETRY, message);
7982
}
8083
return true;
8184
}
8285
boolean hasLogged;
8386
if (response != null) {
8487
hasLogged =
8588
ratelimitedLogger.warn(
86-
"{} Status: {} {}", message, response.getStatusCode(), response.getMessage());
89+
EXCLUDE_TELEMETRY,
90+
"{} Status: {} {}",
91+
message,
92+
response.getStatusCode(),
93+
response.getMessage());
8794
} else if (exception != null) {
8895
// NOTE: We do not pass the full exception to warn on purpose. We don't want to
8996
// print a full stacktrace unless we're in debug mode
9097
hasLogged =
9198
ratelimitedLogger.warn(
92-
"{} {}: {}", message, exception.getClass().getName(), exception.getMessage());
99+
EXCLUDE_TELEMETRY,
100+
"{} {}: {}",
101+
message,
102+
exception.getClass().getName(),
103+
exception.getMessage());
93104
} else {
94105
hasLogged = ratelimitedLogger.warn(message);
95106
}

0 commit comments

Comments
 (0)