Class ClientInstrumentation

java.lang.Object
com.vaadin.extension.instrumentation.client.ClientInstrumentation
All Implemented Interfaces:
io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation

public class ClientInstrumentation extends Object implements io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation
This instrumentation is applied to the ObservabilityHandler constructor. Because the agent and starter use different class loaders, the code to construct SpanData instances and export them must reside entirely within either the agent or the starter. To achieve this, this injects a consumer into the ObservabilityHandler class. The ObservabilityHandler converts the incoming JSON string into a Map of objects that are only contained within the java.util and java .lang packages. It then sends this to the consumer. This means that there are no class loader issues.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Class representing the code injected into the ObservabilityHandler constructor.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.bytebuddy.matcher.ElementMatcher<ClassLoader>
    Returns an element matcher for the ObservabilityHandler class.
    void
    transform(io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer transformer)
    Sets callbacks on the ConstructorAdvice class and applies this class to the constructor of an ObservabilityHandler instance.
    net.bytebuddy.matcher.ElementMatcher<net.bytebuddy.description.type.TypeDescription>
    Returns an element matcher for the ObservabilityHandler class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClientInstrumentation

      public ClientInstrumentation()
  • Method Details

    • classLoaderOptimization

      public net.bytebuddy.matcher.ElementMatcher<ClassLoader> classLoaderOptimization()
      Returns an element matcher for the ObservabilityHandler class.
      Specified by:
      classLoaderOptimization in interface io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation
      Returns:
      an element matcher
    • typeMatcher

      public net.bytebuddy.matcher.ElementMatcher<net.bytebuddy.description.type.TypeDescription> typeMatcher()
      Returns an element matcher for the ObservabilityHandler class.
      Specified by:
      typeMatcher in interface io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation
      Returns:
      an element matcher
    • transform

      public void transform(io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer transformer)
      Sets callbacks on the ConstructorAdvice class and applies this class to the constructor of an ObservabilityHandler instance.
      Specified by:
      transform in interface io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation
      Parameters:
      transformer - the TypeTransformer