Skip to content

Commit

Permalink
Akka server indy support (#12243)
Browse files Browse the repository at this point in the history
  • Loading branch information
LikeTheSalad authored Sep 13, 2024
1 parent 32fd44e commit 68e844e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@
import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@AutoService(InstrumentationModule.class)
public class AkkaHttpServerInstrumentationModule extends InstrumentationModule {
public class AkkaHttpServerInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {
public AkkaHttpServerInstrumentationModule() {
super("akka-http", "akka-http-10.0", "akka-http-server");
}

@Override
public String getModuleGroup() {
return "akka-http";
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
// in GraphInterpreterInstrumentation we instrument a class that belongs to akka-streams, make
// sure this runs only when akka-http is present to avoid muzzle failures
return hasClassesNamed("akka.http.scaladsl.HttpExt");
}

@Override
public boolean isIndyModule() {
// AkkaHttpServerInstrumentationModule and AkkaHttpServerRouteInstrumentationModule share
// AkkaRouteHolder class
return false;
}

@Override
public List<TypeInstrumentation> typeInstrumentations() {
return asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
import java.util.List;

/**
* This instrumentation applies to classes in akka-http.jar while
* AkkaHttpServerInstrumentationModule applies to classes in akka-http-core.jar
*/
@AutoService(InstrumentationModule.class)
public class AkkaHttpServerRouteInstrumentationModule extends InstrumentationModule {
public class AkkaHttpServerRouteInstrumentationModule extends InstrumentationModule
implements ExperimentalInstrumentationModule {
public AkkaHttpServerRouteInstrumentationModule() {
super("akka-http", "akka-http-10.0", "akka-http-server", "akka-http-server-route");
}

@Override
public boolean isIndyModule() {
// AkkaHttpServerInstrumentationModule and AkkaHttpServerRouteInstrumentationModule share
// AkkaRouteHolder class
return false;
public String getModuleGroup() {
return "akka-http";
}

@Override
Expand Down

0 comments on commit 68e844e

Please sign in to comment.