Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import datadog.communication.monitor.DDAgentStatsDClientManager;
import datadog.communication.monitor.Monitoring;
import datadog.communication.monitor.Recording;
import datadog.trace.api.BaseHash;
import datadog.trace.api.telemetry.LogCollector;
import datadog.trace.util.Strings;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -228,7 +229,16 @@ private String probeTracesEndpoint(String[] endpoints) {
}

private void processInfoResponseHeaders(Response response) {
ContainerInfo.get().setContainerTagsHash(response.header(DATADOG_CONTAINER_TAGS_HASH));
String newContainerTagsHash = response.header(DATADOG_CONTAINER_TAGS_HASH);
if (newContainerTagsHash != null) {
ContainerInfo containerInfo = ContainerInfo.get();
synchronized (containerInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the info endpoint cannot be called concurrently so perhaps this might be avoided

if (!newContainerTagsHash.equals(containerInfo.getContainerTagsHash())) {
containerInfo.setContainerTagsHash(newContainerTagsHash);
BaseHash.recalcBaseHash(newContainerTagsHash);
}
}
}
}

@SuppressWarnings("unchecked")
Expand Down
5 changes: 0 additions & 5 deletions dd-java-agent/instrumentation/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,3 @@ tasks.named("latestDepJava11Test").configure {
tasks.withType(Test).configureEach {
usesService(testcontainersLimit)
}

jmh {
jmhVersion = libs.versions.jmh.get()
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public static String onEnter(
if (callDepth > 0) {
return null;
}
final String inputSql = sql;
final DBInfo dbInfo =
JDBCDecorator.parseDBInfo(
connection, InstrumentationContext.get(Connection.class, DBInfo.class));
Expand All @@ -125,16 +124,9 @@ public static String onEnter(
dbService =
traceConfig(activeSpan()).getServiceMapping().getOrDefault(dbService, dbService);
}
if (dbInfo.getType().equals("sqlserver")) {
sql =
SQLCommenter.append(
sql, dbService, dbInfo.getType(), dbInfo.getHost(), dbInfo.getDb());
} else {
sql =
SQLCommenter.prepend(
sql, dbService, dbInfo.getType(), dbInfo.getHost(), dbInfo.getDb());
}
return inputSql;
boolean append = "sqlserver".equals(dbInfo.getType());
return SQLCommenter.inject(
sql, dbService, dbInfo.getType(), dbInfo.getHost(), dbInfo.getDb(), null, append);
}
return sql;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public class JDBCDecorator extends DatabaseClientDecorator<DBInfo> {

public static final String DD_INSTRUMENTATION_PREFIX = "_DD_";

public static final String DBM_PROPAGATION_MODE = Config.get().getDBMPropagationMode();
public static final String DBM_PROPAGATION_MODE = Config.get().getDbmPropagationMode();
public static final boolean INJECT_COMMENT =
DBM_PROPAGATION_MODE.equals(DBM_PROPAGATION_MODE_FULL)
|| DBM_PROPAGATION_MODE.equals(DBM_PROPAGATION_MODE_STATIC);
private static final boolean INJECT_TRACE_CONTEXT =
DBM_PROPAGATION_MODE.equals(DBM_PROPAGATION_MODE_FULL);
public static final boolean DBM_TRACE_PREPARED_STATEMENTS =
Config.get().isDBMTracePreparedStatements();
Config.get().isDbmTracePreparedStatements();

private volatile boolean warnedAboutDBMPropagationMode = false; // to log a warning only once

Expand Down Expand Up @@ -420,7 +420,7 @@ public boolean shouldInjectTraceContext(DBInfo dbInfo) {
}

public boolean shouldInjectSQLComment() {
return Config.get().getDBMPropagationMode().equals(DBM_PROPAGATION_MODE_FULL)
|| Config.get().getDBMPropagationMode().equals(DBM_PROPAGATION_MODE_STATIC);
return Config.get().getDbmPropagationMode().equals(DBM_PROPAGATION_MODE_FULL)
|| Config.get().getDbmPropagationMode().equals(DBM_PROPAGATION_MODE_STATIC);
}
}
Loading
Loading