Skip to content

Commit

Permalink
Move HasMethodAdvice aspect to instrumentations, away from modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mcculls committed Dec 31, 2024
1 parent c99c2c2 commit 61fb7f5
Show file tree
Hide file tree
Showing 751 changed files with 902 additions and 782 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected final boolean isShortcutMatchingEnabled(boolean defaultToShortcut) {
}

/** Parent class for all tracing related instrumentations */
public abstract static class Tracing extends InstrumenterModule implements HasMethodAdvice {
public abstract static class Tracing extends InstrumenterModule {
public Tracing(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand All @@ -203,7 +203,7 @@ public boolean isApplicable(Set<TargetSystem> enabledSystems) {
}

/** Parent class for all profiling related instrumentations */
public abstract static class Profiling extends InstrumenterModule implements HasMethodAdvice {
public abstract static class Profiling extends InstrumenterModule {
public Profiling(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand All @@ -222,7 +222,7 @@ public boolean isEnabled() {
}

/** Parent class for all AppSec related instrumentations */
public abstract static class AppSec extends InstrumenterModule implements HasMethodAdvice {
public abstract static class AppSec extends InstrumenterModule {
public AppSec(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand All @@ -235,8 +235,7 @@ public boolean isApplicable(Set<TargetSystem> enabledSystems) {

/** Parent class for all IAST related instrumentations */
@SuppressForbidden
public abstract static class Iast extends InstrumenterModule
implements HasMethodAdvice, WithPostProcessor {
public abstract static class Iast extends InstrumenterModule implements WithPostProcessor {
public Iast(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand Down Expand Up @@ -291,7 +290,7 @@ protected boolean isOptOutEnabled() {
}

/** Parent class for all USM related instrumentations */
public abstract static class Usm extends InstrumenterModule implements HasMethodAdvice {
public abstract static class Usm extends InstrumenterModule {
public Usm(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand All @@ -303,7 +302,7 @@ public boolean isApplicable(Set<TargetSystem> enabledSystems) {
}

/** Parent class for all CI related instrumentations */
public abstract static class CiVisibility extends InstrumenterModule implements HasMethodAdvice {
public abstract static class CiVisibility extends InstrumenterModule {
public CiVisibility(String instrumentationName, String... additionalNames) {
super(instrumentationName, additionalNames);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@AutoService(InstrumenterModule.class)
public final class AerospikeClientInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public AerospikeClientInstrumentation() {
super("aerospike");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@AutoService(InstrumenterModule.class)
public final class CommandInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public CommandInstrumentation() {
super("aerospike");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@AutoService(InstrumenterModule.class)
public final class NioEventLoopInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public NioEventLoopInstrumentation() {
super("aerospike", "java_concurrent");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@AutoService(InstrumenterModule.class)
public final class PartitionInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public PartitionInstrumentation() {
super("aerospike");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@AutoService(InstrumenterModule.class)
public class AkkaActorCellInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {

public AkkaActorCellInstrumentation() {
super("akka_actor_receive", "akka_actor", "akka_concurrent", "java_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@AutoService(InstrumenterModule.class)
public class AkkaEnvelopeInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {

public AkkaEnvelopeInstrumentation() {
super("akka_actor_send", "akka_actor", "akka_concurrent", "java_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
@AutoService(InstrumenterModule.class)
public final class AkkaForkJoinExecutorTaskInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public AkkaForkJoinExecutorTaskInstrumentation() {
super("java_concurrent", "akka_concurrent");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@AutoService(InstrumenterModule.class)
public final class AkkaForkJoinPoolInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {

public AkkaForkJoinPoolInstrumentation() {
super("java_concurrent", "akka_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
@AutoService(InstrumenterModule.class)
public final class AkkaForkJoinTaskInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForTypeHierarchy, ExcludeFilterProvider {
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice, ExcludeFilterProvider {

public AkkaForkJoinTaskInstrumentation() {
super("java_concurrent", "akka_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@AutoService(InstrumenterModule.class)
public class AkkaMailboxInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType, ExcludeFilterProvider {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice, ExcludeFilterProvider {

public AkkaMailboxInstrumentation() {
super("akka_actor_mailbox", "akka_actor", "akka_concurrent", "java_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@AutoService(InstrumenterModule.class)
public class AkkaRoutedActorCellInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {

public AkkaRoutedActorCellInstrumentation() {
super("akka_actor_send", "akka_actor", "akka_concurrent", "java_concurrent");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
@AutoService(InstrumenterModule.class)
public final class AkkaHttp2ServerInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {
public AkkaHttp2ServerInstrumentation() {
super("akka-http2", "akka-http", "akka-http-server");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
@AutoService(InstrumenterModule.class)
public final class AkkaHttpServerInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public AkkaHttpServerInstrumentation() {
super("akka-http", "akka-http-server");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@AutoService(InstrumenterModule.class)
public final class AkkaHttpSingleRequestInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public AkkaHttpSingleRequestInstrumentation() {
super("akka-http", "akka-http-client");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@AutoService(InstrumenterModule.class)
public final class AkkaPoolMasterActorInstrumentation extends InstrumenterModule.Tracing
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public AkkaPoolMasterActorInstrumentation() {
super("akka-http", "akka-http-client");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@AutoService(InstrumenterModule.class)
public class DefaultExceptionHandlerInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public DefaultExceptionHandlerInstrumentation() {
super("akka-http", "akka-http-server");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
/** See https://github.com/akka/akka-http/issues/4304 */
@AutoService(InstrumenterModule.class)
public class Bug4304Instrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForTypeHierarchy, Instrumenter.WithTypeStructure {
implements Instrumenter.ForTypeHierarchy,
Instrumenter.WithTypeStructure,
Instrumenter.HasMethodAdvice {
public Bug4304Instrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@AutoService(InstrumenterModule.class)
public class ConfigProvideRemoteAddressHeaderInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public ConfigProvideRemoteAddressHeaderInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
/** @see akka.http.scaladsl.model.Multipart.FormData#toStrict(FiniteDuration, Materializer) */
@AutoService(InstrumenterModule.class)
public class FormDataToStrictInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForSingleType, ScalaListCollectorMuzzleReferences {
implements Instrumenter.ForSingleType,
Instrumenter.HasMethodAdvice,
ScalaListCollectorMuzzleReferences {
public FormDataToStrictInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@AutoService(InstrumenterModule.class)
public class JacksonUnmarshallerInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {

public JacksonUnmarshallerInstrumentation() {
super("akka-http");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/** @see MultipartUnmarshallers */
@AutoService(InstrumenterModule.class)
public class MultipartUnmarshallersInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {

private static final String TRAIT_NAME =
"akka.http.scaladsl.unmarshalling.MultipartUnmarshallers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
@AutoService(InstrumenterModule.class)
public class PredefinedFromEntityUnmarshallersInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {

private static final String TRAIT_NAME =
"akka.http.scaladsl.unmarshalling.PredefinedFromEntityUnmarshallers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// TODO: move to separate module and have better support
@AutoService(InstrumenterModule.class)
public class SprayUnmarshallerInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {

private static final String TRAIT_NAME =
"akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/** @see akka.http.scaladsl.common.StrictForm$#unmarshaller(Unmarshaller, Unmarshaller) */
@AutoService(InstrumenterModule.class)
public class StrictFormCompanionInstrumentation extends InstrumenterModule.AppSec
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public StrictFormCompanionInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
@AutoService(InstrumenterModule.class)
public class CookieDirectivesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {
public CookieDirectivesInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
@AutoService(InstrumenterModule.class)
public class CookieHeaderInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public CookieHeaderInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
@AutoService(InstrumenterModule.class)
public class ExtractDirectivesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {
public ExtractDirectivesInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
@AutoService(InstrumenterModule.class)
public class FormDataInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public FormDataInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@AutoService(InstrumenterModule.class)
public class FormFieldDirectivesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {

private static final String TRAIT_CLASS =
"akka.http.scaladsl.server.directives.FormFieldDirectives";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
@AutoService(InstrumenterModule.class)
public class HttpHeaderSubclassesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForTypeHierarchy {
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public HttpHeaderSubclassesInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
@AutoService(InstrumenterModule.class)
public class HttpRequestInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public HttpRequestInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,4 @@ public String[] knownMatchingTypes() {
public void typeAdvice(TypeTransformer transformer) {
transformer.applyAdvice(new TaintableVisitor(knownMatchingTypes()));
}

@Override
public void methodAdvice(MethodTransformer transformer) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
@AutoService(InstrumenterModule.class)
public class MarshallingDirectivesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {

public MarshallingDirectivesInstrumentation() {
super("akka-http");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@AutoService(InstrumenterModule.class)
public class ParameterDirectivesInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForKnownTypes {
implements Instrumenter.ForKnownTypes, Instrumenter.HasMethodAdvice {
private static final String TRAIT_NAME =
"akka.http.scaladsl.server.directives.ParameterDirectives";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
@AutoService(InstrumenterModule.class)
public class PathMatcherInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public PathMatcherInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/** Propagates taint when fetching the {@link HttpRequest} from the {@link RequestContext}. */
@AutoService(InstrumenterModule.class)
public class RequestContextInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public RequestContextInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
@AutoService(InstrumenterModule.class)
public class UnmarshallerInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForTypeHierarchy {
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public UnmarshallerInstrumentation() {
super("akka-http");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/** Propagates taint from a {@link Uri} to query strings fetched from it. */
@AutoService(InstrumenterModule.class)
public class UriInstrumentation extends InstrumenterModule.Iast
implements Instrumenter.ForSingleType {
implements Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
public UriInstrumentation() {
super("akka-http");
}
Expand Down
Loading

0 comments on commit 61fb7f5

Please sign in to comment.