Prevent instrumentation from applying too broadly
MODIFY
instrumentation/opentelemetry-api-0.3/src/main/java/io/opentelemetry/auto/instrumentation/opentelemetryapi/GrpcContextInstrumentation.java
instrumentation/opentelemetry-api-0.3/src/main/java/io/opentelemetry/auto/instrumentation/opentelemetryapi/GrpcContextInstrumentation.java
@@ -24,6 +24,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import com.google.auto.service.AutoService;
import io.opentelemetry.auto.bootstrap.ContextStore;
import io.opentelemetry.auto.bootstrap.InstrumentationContext;
+import io.opentelemetry.auto.instrumentation.opentelemetryapi.context.ContextUtils;
import io.opentelemetry.auto.tooling.Instrumenter;
import java.util.HashMap;
import java.util.Map;
@@ -58,5 +59,11 @@ public class GrpcContextInstrumentation extends AbstractInstrumentation {
InstrumentationContext.get(Context.class, io.grpc.Context.class);
contextStore.put(context, io.grpc.Context.current());
}
+
+ // this is to make muzzle think we need ContextUtils to make sure we do not apply this
+ // instrumentation when ContextUtils would not work
+ public static Object muzzleCheck() {
+ return ContextUtils.class;
+ }
}
}

Prevent instrumentation from applying too broadly (#337)