Class ReferenceCollector
- java.lang.Object
-
- io.opentelemetry.javaagent.tooling.muzzle.collector.ReferenceCollector
-
public class ReferenceCollector extends Object
LinkedHashMapis used for reference map to guarantee a deterministic order of iteration, so that bytecode generated based on it would also be deterministic.This class is only called at compile time by the
MuzzleCodeGenerationPluginByteBuddy plugin.
-
-
Constructor Summary
Constructors Constructor Description ReferenceCollector(Predicate<String> libraryInstrumentationPredicate)ReferenceCollector(Predicate<String> libraryInstrumentationPredicate, ClassLoader resourceLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectReferencesFromAdvice(String adviceClassName)Traverse a graph of classes starting fromadviceClassNameand collect all references to both internal (instrumentation) and external classes.voidcollectReferencesFromResource(String resource)If passedresourcepath points to an SPI file (either JavaServiceLoaderor AWS SDKExecutionInterceptor) reads the file and adds every implementation as a reference, traversing the graph of classes until a non-instrumentation (external) class is encountered.Map<String,String>getContextStoreClasses()Map<String,io.opentelemetry.javaagent.extension.muzzle.ClassRef>getReferences()List<String>getSortedHelperClasses()voidprune()
-
-
-
Constructor Detail
-
ReferenceCollector
public ReferenceCollector(Predicate<String> libraryInstrumentationPredicate, ClassLoader resourceLoader)
-
-
Method Detail
-
collectReferencesFromResource
public void collectReferencesFromResource(String resource)
If passedresourcepath points to an SPI file (either JavaServiceLoaderor AWS SDKExecutionInterceptor) reads the file and adds every implementation as a reference, traversing the graph of classes until a non-instrumentation (external) class is encountered.- Parameters:
resource- path to the resource file, same as inClassLoader.getResource(String)- See Also:
InstrumentationClassPredicate
-
collectReferencesFromAdvice
public void collectReferencesFromAdvice(String adviceClassName)
Traverse a graph of classes starting fromadviceClassNameand collect all references to both internal (instrumentation) and external classes.The graph of classes is traversed until a non-instrumentation (external) class is encountered.
- Parameters:
adviceClassName- Starting point for generating references.- See Also:
InstrumentationClassPredicate
-
getReferences
public Map<String,io.opentelemetry.javaagent.extension.muzzle.ClassRef> getReferences()
-
prune
public void prune()
-
-