Class BasePulsarProducerInstrumentation

java.lang.Object
org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
org.apache.skywalking.apm.plugin.pulsar.common.define.BasePulsarProducerInstrumentation

public abstract class BasePulsarProducerInstrumentation extends org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
Pulsar producer instrumentation.

The pulsar producer instrumentation use ProducerImpl as an enhanced class. Producer is a user-oriented interface and the implementations of the Producer are PartitionedProducerImpl and ProducerImpl.

And the PartitionedProducerImpl is a complex type with multiple ProducerImpl to support uses send messages to multiple partitions. As each ProducerImpl has it's own topic name and it is the initial unit of a single topic to send messages, so use ProducerImpl as an enhanced class is an effective way.

About the enhanced methods, currently use ProducerImpl.sendAsync(org.apache.pulsar.client.api.Message, org.apache.pulsar.client.impl.SendCallback) as the enhanced method. Pulsar provides users with two kinds of methods for sending messages sync methods and async methods. The async method use as the method result, if use this method as the enhanced method is hard to pass the snapshot of span, because can't ensure that the CompletableFuture is completed after the skywalking dynamic field was updated. But execution time of sync method will be inaccurate.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     

    Fields inherited from class org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine

    CONTEXT_ATTR_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
     
    org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint[]
     
    protected abstract String
    Get producer constructor intercept point
    org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint[]
     

    Methods inherited from class org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine

    getStaticMethodsInterceptPoints

    Methods inherited from class org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine

    enhanceClass, enhanceInstance, getInstanceMethodsInterceptV2Points, getStaticMethodsInterceptV2Points

    Methods inherited from class org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine

    define, enhance, isBootstrapInstrumentation, witnessClasses, witnessMethods

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • BasePulsarProducerInstrumentation

      public BasePulsarProducerInstrumentation()
  • Method Details

    • getConstructorsInterceptPoints

      public org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint[] getConstructorsInterceptPoints()
      Specified by:
      getConstructorsInterceptPoints in class org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine
    • getCustomConstructorInterceptor

      protected abstract String getCustomConstructorInterceptor()
      Get producer constructor intercept point
      Returns:
      producer interceptor
    • getInstanceMethodsInterceptPoints

      public org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints()
      Specified by:
      getInstanceMethodsInterceptPoints in class org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine
    • enhanceClass

      protected org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch enhanceClass()
      Specified by:
      enhanceClass in class org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine