Skip to content

Commit 4f22d2b

Browse files
# This is a combination of 2 commits.
# This is the 1st commit message: Removing statements that log sensitive information and exceptions since they would be sent over the wire by the telemetry logging API Changing statements so they use placeholders instead of adding strings # This is the commit message #2: linter applied Update dd-smoke-tests/jboss-modules/src/main/java/datadog/smoketest/jbossmodules/common/ServiceSupport.java Co-authored-by: Santiago M. Mola <[email protected]> processing PR comments Processing PR comments This statement doesn't need the placeholder
1 parent 42a3ef6 commit 4f22d2b

File tree

21 files changed

+31
-28
lines changed

21 files changed

+31
-28
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ private static synchronized void registerDeadlockDetectionEvent() {
640640
private static synchronized void initializeJmxSystemAccessProvider(
641641
final ClassLoader classLoader) {
642642
if (log.isDebugEnabled()) {
643-
log.debug("Initializing JMX system access provider for " + classLoader.toString());
643+
log.debug("Initializing JMX system access provider for {}", classLoader);
644644
}
645645
try {
646646
final Class<?> tracerInstallerClass =
@@ -1036,7 +1036,7 @@ private static boolean isFeatureEnabled(AgentFeature feature) {
10361036
}
10371037
}
10381038

1039-
/** @see datadog.trace.api.ProductActivationConfig#fromString(String) */
1039+
/** @see datadog.trace.api.ProductActivation#fromString(String) */
10401040
private static boolean isAppSecFullyDisabled() {
10411041
// must be kept in sync with logic from Config!
10421042
final String featureEnabledSysprop = AgentFeature.APPSEC.systemProp;

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/AgentJarIndex.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static AgentJarIndex readIndex(JarFile agentJar) {
8181
return new AgentJarIndex(prefixes, ClassNameTrie.readFrom(in));
8282
}
8383
} catch (Throwable e) {
84-
log.error("Unable to read " + AGENT_INDEX_FILE_NAME, e);
84+
log.error("Unable to read {}", AGENT_INDEX_FILE_NAME, e);
8585
return null;
8686
}
8787
}

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/jdbc/JDBCConnectionUrlParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ private static void populateStandardProperties(
868868
try {
869869
builder.port(Integer.parseInt(portNumber));
870870
} catch (final NumberFormatException e) {
871-
ExceptionLogger.LOGGER.debug("Error parsing portnumber property: " + portNumber, e);
871+
ExceptionLogger.LOGGER.debug("Error parsing portnumber property: {}", portNumber, e);
872872
}
873873
}
874874

@@ -877,7 +877,7 @@ private static void populateStandardProperties(
877877
try {
878878
builder.port(Integer.parseInt(portNumber));
879879
} catch (final NumberFormatException e) {
880-
ExceptionLogger.LOGGER.debug("Error parsing portNumber property: " + portNumber, e);
880+
ExceptionLogger.LOGGER.debug("Error parsing portNumber property: {}", portNumber, e);
881881
}
882882
}
883883
}

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/agent/DebuggerTransformer.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ private void readExcludeFiles(String commaSeparatedFileNames) {
121121
}
122122
});
123123
} catch (IOException ex) {
124-
log.warn("Error reading exclude file '{}' for Instrument-The-World: ", fileName, ex);
125-
}
124+
log.warn(
125+
"Error reading exclude file '{}' for Instrument-The-World. Exception: {}",
126+
fileName,
127+
ex.getMessage()); }
126128
}
127129
}
128130

@@ -328,7 +330,7 @@ private byte[] writeClassFile(ClassLoader loader, String classFilePath, ClassNod
328330
try {
329331
classNode.accept(writer);
330332
} catch (Throwable t) {
331-
log.error("Cannot write classfile for class: {}", classFilePath, t);
333+
log.error("Cannot write classfile for class: {} Exception: ", classFilePath, t.getMessage());
332334
}
333335
byte[] data = writer.toByteArray();
334336
dumpInstrumentedClassFile(classFilePath, data);

dd-java-agent/agent-jmxfetch/src/main/java/datadog/trace/agent/jmxfetch/JMXFetch.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class JMXFetch {
3131
public static final List<String> DEFAULT_CONFIGS =
3232
Collections.singletonList("jmxfetch-config.yaml");
3333

34-
private static final int DELAY_BETWEEN_RUN_ATTEMPTS = 5000;
34+
private static final int SLEEP_AFTER_JMXFETCH_EXITS = 5000;
3535

3636
public static void run(final StatsDClientManager statsDClientManager) {
3737
run(statsDClientManager, Config.get());
@@ -95,7 +95,6 @@ private static void run(final StatsDClientManager statsDClientManager, final Con
9595
// App should be run as daemon otherwise CLI apps would not exit once main method exits.
9696
.daemon(true)
9797
.embedded(true)
98-
.exitWatcher(new TraceConfigExitWatcher())
9998
.confdDirectory(jmxFetchConfigDir)
10099
.yamlFileList(jmxFetchConfigs)
101100
.targetDirectInstances(true)
@@ -109,7 +108,7 @@ private static void run(final StatsDClientManager statsDClientManager, final Con
109108

110109
if (config.isJmxFetchMultipleRuntimeServicesEnabled()) {
111110
ServiceNameCollectingTraceInterceptor serviceNameProvider =
112-
ServiceNameCollectingTraceInterceptor.INSTANCE;
111+
new ServiceNameCollectingTraceInterceptor();
113112
GlobalTracer.get().addTraceInterceptor(serviceNameProvider);
114113

115114
configBuilder.serviceNameProvider(serviceNameProvider);
@@ -132,9 +131,10 @@ public void run() {
132131
if (!appConfig.getExitWatcher().shouldExit()) {
133132
try {
134133
final int result = app.run();
135-
log.error("jmx collector exited with result: " + result);
134+
log.error("jmx collector exited with result: {}", result);
136135
} catch (final Exception e) {
137136
log.error("Exception in jmx collector thread", e);
137+
138138
}
139139
}
140140
// always wait before next attempt

dd-java-agent/agent-profiling/src/main/java/com/datadog/profiling/agent/ProfilingAgent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static synchronized void run(final boolean isStartingFirst, ClassLoader a
159159
log.warn(e.getMessage());
160160
log.debug("", e);
161161
} catch (final ConfigurationException e) {
162-
log.warn("Failed to initialize profiling agent! " + e.getMessage());
162+
log.warn("Failed to initialize profiling agent! {}", e.getMessage());
163163
log.debug("Failed to initialize profiling agent!", e);
164164
}
165165
}

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/AgentCLI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private static void recursiveDependencySearch(Consumer<File> invoker, File origi
128128

129129
private static void unzipJar(Consumer<File> invoker, File file) throws IOException {
130130
try (JarFile jar = new JarFile(file)) {
131-
log.debug("Finding entries in file:" + file.getName());
131+
log.debug("Finding entries in file: {}", file.getName());
132132

133133
jar.stream()
134134
.forEach(

dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/KnownTypesIndex.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static KnownTypesIndex readIndex() {
7070
}
7171
return new KnownTypesIndex(multipleIdTable, ClassNameTrie.readFrom(in));
7272
} catch (Throwable e) {
73-
log.error("Problem reading " + KNOWN_TYPES_INDEX_NAME, e);
73+
log.error("Problem reading {}", KNOWN_TYPES_INDEX_NAME, e);
7474
}
7575
}
7676
return buildIndex(); // fallback to runtime generation when testing

dd-java-agent/agent-tooling/src/test/java/datadog/trace/agent/tooling/csi/StringConcatExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class StringConcatExample implements BiFunction<String, String, String> {
1111
public String apply(final String first, final String second) {
1212
LOGGER.debug("Before apply");
1313
final String result = first.concat(second);
14-
LOGGER.debug("After apply " + result);
14+
LOGGER.debug("After apply {}", result);
1515
return result;
1616
}
1717
}

dd-java-agent/agent-tooling/src/test/java11/datadog/trace/agent/tooling/csi/StringPlusConstantsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class StringPlusConstantsExample implements TriFunction<String, String, S
1111
public String apply(final String first, final String second, final String third) {
1212
LOGGER.debug("Before apply");
1313
final String result = first + " " + second + " " + third;
14-
LOGGER.debug("After apply " + result);
14+
LOGGER.debug("After apply {}", result);
1515
return result;
1616
}
1717
}

dd-java-agent/agent-tooling/src/test/java11/datadog/trace/agent/tooling/csi/StringPlusExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class StringPlusExample implements TriFunction<String, String, String, St
1111
public String apply(final String first, final String second, final String third) {
1212
LOGGER.debug("Before apply");
1313
final String result = first + second + third;
14-
LOGGER.debug("After apply " + result);
14+
LOGGER.debug("After apply {}", result);
1515
return result;
1616
}
1717
}

dd-java-agent/agent-tooling/src/test/java11/datadog/trace/agent/tooling/csi/StringPlusLoadWithTagsExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class StringPlusLoadWithTagsExample implements TriFunction<String, String
1111
public String apply(final String first, final String second, final String third) {
1212
LOGGER.debug("Before apply");
1313
final String result = first + " \u0002 " + second + " \u0001 " + third;
14-
LOGGER.debug("After apply " + result);
14+
LOGGER.debug("After apply {}", result);
1515
return result;
1616
}
1717
}

dd-java-agent/appsec/src/main/java/com/datadog/appsec/config/AppSecConfigServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private void distributeSubConfigurations(
184184
try {
185185
listener.onNewSubconfig(newConfig.get(key), reconfiguration);
186186
} catch (Exception rte) {
187-
log.warn("Error updating configuration of app sec module listening on key " + key, rte);
187+
log.warn("Error updating configuration of app sec module listening on key {}", key, rte);
188188
}
189189
}
190190
}

dd-java-agent/instrumentation/jsp-2.3/src/main/java/datadog/trace/instrumentation/jsp/JSPDecorator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void onRender(final AgentSpan span, final HttpServletRequest req) {
7272
"jsp.requestURL", (new URI(req.getRequestURL().toString())).normalize().toString());
7373
} catch (final URISyntaxException uriSE) {
7474
LoggerFactory.getLogger(HttpJspPage.class)
75-
.debug("Failed to get and normalize request URL: " + uriSE.getMessage());
75+
.debug("Failed to get and normalize request URL: {}", uriSE.getMessage());
7676
}
7777
}
7878
}

dd-trace-core/src/main/java/datadog/trace/common/writer/TraceStructureWriter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public TraceStructureWriter(String outputFile, boolean debugLog) {
6464
argsDebugLog = true;
6565
break;
6666
default:
67-
log.warn("Illegal TraceStructureWriter argument '" + args[i] + "'");
67+
log.warn("Illegal TraceStructureWriter argument '{}'", args[i]);
6868
break;
6969
}
7070
}

dd-trace-core/src/main/java/datadog/trace/common/writer/ddintake/DDEvpProxyApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public DDEvpProxyApi build() {
8585

8686
final HttpRetryPolicy.Factory retryPolicyFactory = new HttpRetryPolicy.Factory(5, 100, 2.0);
8787

88-
log.debug("proxiedApiUrl: " + proxiedApiUrl);
88+
log.debug("proxiedApiUrl: {}", proxiedApiUrl);
8989
return new DDEvpProxyApi(client, proxiedApiUrl, subdomain, retryPolicyFactory);
9090
}
9191
}

dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ private void registerClassLoader(final ClassLoader classLoader) {
736736
addTraceInterceptor(interceptor);
737737
}
738738
} catch (final ServiceConfigurationError e) {
739-
log.warn("Problem loading TraceInterceptor for classLoader: " + classLoader, e);
739+
log.warn("Problem loading TraceInterceptor for classLoader: {}", classLoader, e);
740740
}
741741
}
742742

dd-trace-ot/correlation-id-injection/src/main/java/datadog/trace/correlation/CorrelationIdInjectors.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private static void enableInjector(String className, InternalTracer tracer) {
3838
Class<?> injectorClass = Class.forName(className);
3939
injectorClass.getConstructor(InternalTracer.class).newInstance(tracer);
4040
} catch (ReflectiveOperationException e) {
41-
log.warn("Failed to enable injector " + className + ".", e);
41+
log.warn("Failed to enable injector {}.", className, e);
4242
}
4343
}
4444

internal-api/src/main/java/datadog/trace/api/Config.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,8 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
799799
tmpApiKey =
800800
new String(Files.readAllBytes(Paths.get(apiKeyFile)), StandardCharsets.UTF_8).trim();
801801
} catch (final IOException e) {
802-
log.error("Cannot read API key from file {}, skipping", apiKeyFile, e);
802+
log.error(
803+
"Cannot read API key from file {}, skipping. Exception {}", apiKeyFile, e.getMessage());
803804
}
804805
}
805806
site = configProvider.getString(SITE, DEFAULT_SITE);

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/ConfigProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public BitSet getIntegerRange(final String key, final BitSet defaultValue) {
249249
try {
250250
return value == null ? defaultValue : ConfigConverter.parseIntegerRangeSet(value, key);
251251
} catch (final NumberFormatException e) {
252-
log.warn("Invalid configuration for " + key, e);
252+
log.warn("Invalid configuration for {}", key, e);
253253
return defaultValue;
254254
}
255255
}

remote-config/src/main/java/datadog/remoteconfig/state/ProductState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public boolean apply(
8080
try {
8181
callListenerCommit(hinter);
8282
} catch (Exception ex) {
83-
log.error("Error committing changes for product" + product, ex);
83+
log.error("Error committing changes for product {}", product, ex);
8484
}
8585
}
8686

0 commit comments

Comments
 (0)