@Override
        public byte[] doInTransform(Instrumentor instrumentor, ClassLoader classLoader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
            final InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);
            target.addField(AsyncContextAccessor.class);
            if (target.hasField("record")) {
                target.addGetter(StampedRecordGetter.class, "record");
            }
            if (target.hasField("recordCollector")) {
                target.addGetter(RecordCollectorGetter.class, "recordCollector");
            }

            if (traceStreamProcess) {
                InstrumentMethod doProcessMethod = target.getDeclaredMethod("doProcess", "long");
                if (doProcessMethod != null) {
                    doProcessMethod.addInterceptor(StreamTaskDoProcessInterceptor.class);
                }
            } else {
                InstrumentMethod addRecordsMethod = target.getDeclaredMethod("addRecords", "org.apache.kafka.common.TopicPartition", "java.lang.Iterable");
                if (addRecordsMethod != null) {
                    addRecordsMethod.addInterceptor(AddRecordsToTasksInterceptor.class);
                }
                InstrumentMethod processMethod = target.getDeclaredMethod("process");
                if (processMethod != null) {
                    processMethod.addInterceptor(ProcessInterceptor.class);
                }
                // 2.6 +
                processMethod = target.getDeclaredMethod("process", "long");
                if (processMethod != null) {
                    processMethod.addInterceptor(ProcessInterceptor.class);
                }
            }

            return target.toBytecode();
        }
@author Harris Gwag (gwagdalf)
@author Taejin Koo
agent-module/plugins/kafka/src/main/java/com/navercorp/pinpoint/plugin/kafka/KafkaPlugin.java