Skip to content
Merged
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 @@ -14,6 +14,7 @@
import datadog.trace.agent.tooling.Instrumenter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import lombok.Data;
Expand All @@ -22,8 +23,10 @@

@AutoService(Instrumenter.class)
public final class ConnectionInstrumentation implements Instrumenter {
public static final Map<Connection, DBInfo> connectionInfo = new WeakHashMap<>();
public static final Map<PreparedStatement, String> preparedStatements = new WeakHashMap<>();
public static final Map<Connection, DBInfo> connectionInfo =
Collections.synchronizedMap(new WeakHashMap<Connection, DBInfo>());
public static final Map<PreparedStatement, String> preparedStatements =
Collections.synchronizedMap(new WeakHashMap<PreparedStatement, String>());

@Override
public AgentBuilder instrument(final AgentBuilder agentBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
import datadog.trace.api.DDTags;
import io.opentracing.Scope;
import io.opentracing.util.GlobalTracer;
import java.sql.PreparedStatement;
import java.util.Map;
import java.util.WeakHashMap;
import javax.servlet.http.HttpServletRequest;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.asm.Advice;
import org.springframework.web.servlet.HandlerMapping;

@AutoService(Instrumenter.class)
public final class SpringWebInstrumentation implements Instrumenter {
public static final Map<PreparedStatement, String> preparedStatements = new WeakHashMap<>();

@Override
public AgentBuilder instrument(final AgentBuilder agentBuilder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@
import io.opentracing.tag.Tags;
import io.opentracing.util.GlobalTracer;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.asm.Advice;

@AutoService(Instrumenter.class)
public final class TraceAnnotationInstrumentation implements Instrumenter {
public static final Map<PreparedStatement, String> preparedStatements = new WeakHashMap<>();

@Override
public AgentBuilder instrument(final AgentBuilder agentBuilder) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package datadog.trace.agent.tooling;

import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import net.bytebuddy.matcher.ElementMatcher;

Expand Down Expand Up @@ -46,7 +48,8 @@ public boolean matches(final ClassLoader target) {
public static class ClassLoaderHasClassMatcher
extends ElementMatcher.Junction.AbstractBase<ClassLoader> {

private final WeakHashMap<ClassLoader, Boolean> cache = new WeakHashMap<>();
private final Map<ClassLoader, Boolean> cache =
Collections.synchronizedMap(new WeakHashMap<ClassLoader, Boolean>());

private final String[] names;

Expand Down Expand Up @@ -80,7 +83,8 @@ public boolean matches(final ClassLoader target) {
public static class ClassLoaderHasClassWithFieldMatcher
extends ElementMatcher.Junction.AbstractBase<ClassLoader> {

private final WeakHashMap<ClassLoader, Boolean> cache = new WeakHashMap<>();
private final Map<ClassLoader, Boolean> cache =
Collections.synchronizedMap(new WeakHashMap<ClassLoader, Boolean>());

private final String className;
private final String fieldName;
Expand Down