Class ReferenceCollector
- java.lang.Object
-
- io.opentelemetry.javaagent.tooling.muzzle.ReferenceCollector
-
public final 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, 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(HelperResource helperResource)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,ClassRef>getReferences()List<String>getSortedHelperClasses()VirtualFieldMappingsgetVirtualFieldMappings()voidprune()
-
-
-
Constructor Detail
-
ReferenceCollector
public ReferenceCollector(Predicate<String> libraryInstrumentationPredicate, ClassLoader resourceLoader)
-
-
Method Detail
-
collectReferencesFromResource
public void collectReferencesFromResource(HelperResource helperResource)
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.- See Also:
HelperClassPredicate
-
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:
HelperClassPredicate
-
prune
public void prune()
-
getVirtualFieldMappings
public VirtualFieldMappings getVirtualFieldMappings()
-
-