Class ReferenceCollector
java.lang.Object
io.opentelemetry.javaagent.tooling.muzzle.ReferenceCollector
LinkedHashMap is 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 MuzzleCodeGenerationPlugin ByteBuddy
plugin.
-
Constructor Summary
ConstructorsConstructorDescriptionReferenceCollector(Predicate<String> libraryInstrumentationPredicate, ClassLoader resourceLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectReferencesFromAdvice(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.voidprune()
-
Constructor Details
-
ReferenceCollector
public ReferenceCollector(Predicate<String> libraryInstrumentationPredicate, ClassLoader resourceLoader)
-
-
Method Details
-
collectReferencesFromResource
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:
-
collectReferencesFromAdvice
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:
-
getReferences
-
prune
public void prune() -
getSortedHelperClasses
-
getVirtualFieldMappings
-