Class ReferenceCollector

java.lang.Object
io.opentelemetry.javaagent.tooling.muzzle.ReferenceCollector

public final class ReferenceCollector extends Object
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 Details

  • Method Details

    • collectReferencesFromResource

      public void collectReferencesFromResource(HelperResource helperResource)
      If passed resource path points to an SPI file (either Java ServiceLoader or AWS SDK ExecutionInterceptor) 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

      public void collectReferencesFromAdvice(String adviceClassName)
      Traverse a graph of classes starting from adviceClassName and 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

      public Map<String,ClassRef> getReferences()
    • prune

      public void prune()
    • getSortedHelperClasses

      public List<String> getSortedHelperClasses()
    • getVirtualFieldMappings

      public VirtualFieldMappings getVirtualFieldMappings()