[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404820
 
 
   
   
   
tiny-rpc-3.4.7=com.hsjry.monitor.sw.client.agent.define.TinyRPCInstrumentation
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404721
 
 
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   # http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   
tiny-rpc-3.4.7=com.hsjry.monitor.sw.client.agent.define.TinyRPCInstrumentation
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404721
 
 
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   # http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   
tiny-rpc-3.4.7=com.hsjry.monitor.sw.client.agent.define.TinyRPCInstrumentation
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404492
 
 
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   # http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   
tiny-rpc-3.4.7=com.hsjry.monitor.sw.client.agent.define.TinyRPCInstrumentation
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404378
 
 
   package com.hsjry.monitor.sw.client.agent.define;
   
   import net.bytebuddy.description.method.MethodDescription;
   import net.bytebuddy.matcher.ElementMatcher;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
   import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
   import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
   
   import static net.bytebuddy.matcher.ElementMatchers.named;
   import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
   
   public class TinyRPCInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
   private static final String ENHANCE_CLASS = 
"org.tinygroup.cepcoremutiremoteimpl.node.CEPCoreClientImpl";
   private static final String INTERCEPT_CLASS = 
"com.hsjry.monitor.sw.client.agent.TinyRPCInterceptor";
   
   @Override
   protected ClassMatch enhanceClass() {
   return NameMatch.byName(ENHANCE_CLASS);
   }
   
   @Override
   protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
   //return new ConstructorInterceptPoint[] {
   //new ConstructorInterceptPoint() {
   //@Override
   //public ElementMatcher 
getConstructorMatcher() {
   //return any();
   //}
   //
   //@Override
   //public String getConstructorInterceptor() {
   //return CONSTRUCTOR_INTERCEPT_CLASS;
   //}
   //}
   //};
   return new ConstructorInterceptPoint[0];
   }
   
   @Override
   protected InstanceMethodsInterceptPoint[] 
getInstanceMethodsInterceptPoints() {
   return new InstanceMethodsInterceptPoint[] {
   new InstanceMethodsInterceptPoint() {
   @Override
   public ElementMatcher 
getMethodsMatcher() {
   return named("sendEvent");
   }
   
   @Override
   public String getMethodsInterceptor() {
   return INTERCEPT_CLASS;
   }
   
   @Override public boolean isOverrideArgs() {
   return false;
   }
   }
   };
   }
   }
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404427
 
 
   //
   // Source code recreated from a .class file by IntelliJ IDEA
   // (powered by Fernflower decompiler)
   //
   
   package org.tinygroup.cepcoremutiremoteimpl.node;
   
   import io.netty.bootstrap.Bootstrap;
   import io.netty.channel.ChannelHandler;
   import io.netty.channel.ChannelInitializer;
   import io.netty.channel.ChannelOption;
   import io.netty.channel.socket.SocketChannel;
   import io.netty.channel.socket.nio.NioSocketChannel;
   import io.netty.handler.codec.serialization.ClassResolvers;
   import io.netty.handler.timeout.IdleStateHandler;
   import java.util.concurrent.TimeUnit;
   import org.tinygroup.cepcore.CEPCore;
   import org.tinygroup.cepcoremutiremoteimpl.util.ParamUtil;
   import org.tinygroup.event.Event;
   import org.tinygroup.event.central.Node;
   import org.tinygroup.logger.LogLevel;
   import org.tinygroup.logger.Logger;
   import org.tinygroup.logger.LoggerFactory;
   import org.tinygroup.nettyremote.codec.serialization.HessianDecoder;
   import org.tinygroup.nettyremote.codec.serialization.HessianEncoder;
   import org.tinygroup.nettyremote.impl.ClientImpl;
   
   public class CEPCoreClientImpl extends ClientImpl {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(CEPCoreClientImpl.class);
   private Node node;
   private CEPCore core;
   private NodeHandler nodeHandler;
   private int scReConnectInterval = 0;
   
   protected int getReConnectInterval() {
   if (this.scReConnectInterval != 0) {
   return this.scReConnectInterval;
   } else {
   this.scReConnectInterval = 
ParamUtil.getParamIntValue("sc-reconnect-interval", 
super.getReConnectInterval());
   return this.scReConnectInterval;
   }
   }
   
   public CEPCoreClientImpl(int remotePort, String remoteHost, Node node, 
CEPCore core) {
   super(remotePort, remoteHost, true);
   this.node = node;
   this.core = core;
   }
   
   public void reReg() {
   this.nodeHandler.reRegToSc(this);
   }
   
   public void unReg() {
   this.nodeHandler.unRegToSc(this);
   }
   
   public void unEnable() {
   this.nodeHandler.enableToSc(this, false);
   }
   
   public void enable() {
   this.nodeHandler.enableToSc(this, true);
   }
   
   public void stop() {
   LOGGER.logMessage(LogLevel.INFO, "开始停止与SC ip:{} port:{}的连接", new 
Object[]{this.getRemoteHost(), this.getRemotePort()});
   super.beginStop();
   
   try {
   this.unReg();
   } catch (Exception var2) {
   LOGGER.errorMessage("向sc注销时发生异常", var2, new Object[0]);
   }
   
   super.stop();
   LOGGER.logMessage(LogLevel.INFO, "停止与SC ip:{} port:{}的连接完成", new 
Object[]{this.getRemoteHost(), this.getRemotePort()});
   }
   
   private void writeEvent(Event event) {
   ResponseManager.putIfAbsent(event.getEventId());
   this.write(event);
   }
   
   public Event sentEvent(Event event) {
   this.writeEvent(event);
   return ResponseManager.getResponse(event.getEventId(), 
event.getServiceRequest().getServiceId());
   }
   
   protected void init(Bootstrap b) {
   
((Bootstrap)((Bootstrap)((Bootstrap)b.channel(NioSocketChannel.class)).option(ChannelOption.TCP_NODELAY,
 true)).option(ChannelOption.SO_KEEPALIVE, true)).handler(new 
ChannelInitializer() {
   public void initChannel(SocketChannel ch) throws Exception {
   ch.pipeline().addLast(new ChannelHandler[]{new 
HessianDecoder(ParamUtil.getPackageMaxSize(), 
ClassResolvers.cacheDisabled((ClassLoader)null))});
   ch.pipeline().addLast("MessageEncoder", new 
HessianEncoder());
   Integer heartBeatTime = ParamUtil.getHeartBeatTime();
   if (heartBeatTime != 0) {
   ch.pipeline().addLast(new ChannelHandler[]{new 
IdleStateHandler(0L, 0L, (long)heartBeatTime, TimeUnit.SECONDS)});
   }
   
   CEPCoreClientImpl.this.nodeHandler = new 
NodeHandler(CEPCoreClientImpl.this, CEPCoreClientImpl.this.node, 
CEPCoreClientImpl.this.core);
   ch.pipeline().addLast(new 
ChannelHandler[]{CEPCoreClientImpl.this.nodeHandler});
   }
   });
   }
   }
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404343
 
 
   package com.hsjry.monitor.sw.client.agent;
   
   import com.google.common.base.MoreObjects;
   import org.apache.skywalking.apm.agent.core.context.CarrierItem;
   import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
   import org.apache.skywalking.apm.agent.core.context.ContextManager;
   import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
   import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
   import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
   import org.apache.skywalking.apm.network.trace.component.Component;
   import org.tinygroup.event.Event;
   
   import java.lang.reflect.Method;
   
   public class TinyRPCInterceptor implements InstanceMethodsAroundInterceptor {
   
   private static String generateViewPoint(Event request) {
   StringBuilder viewPoint = new 
StringBuilder(request.getServiceRequest().getNodeName());
   viewPoint.append("." + request.getServiceRequest().getServiceId());
   viewPoint.append("(" + 
request.getServiceRequest().getContext().getItemMap().toString() + ")");
   return viewPoint.toString();
   }
   
   @Override
   public void beforeMethod(EnhancedInstance enhancedInstance, Method 
method, Object[] objects, Class[] classes, MethodInterceptResult 
methodInterceptResult) throws Throwable {
   Event request = (Event)objects[0];
   ContextCarrier contextCarrier = new ContextCarrier();
   CarrierItem next = contextCarrier.items();
   while (next.hasNext()) {
   next = next.next();
   
next.setHeadValue(MoreObjects.toStringHelper(request.getServiceRequest().getContext().getItemMap().get(next.getHeadKey())).toString());
   }
   
   AbstractSpan span = 
ContextManager.createEntrySpan(generateViewPoint(request), contextCarrier);
   SpanLayer.asRPCFramework(span);
   span.setComponent(new Component() {
   @Override
   public int getId() {
   return 110;
   }
   
   @Override
   public String getName() {
   return "tiny-rpc";
   }
   });
   }
   
   @Override
   public Object afterMethod(EnhancedInstance enhancedInstance, Method 
method, Object[] objects, Class[] classes, Object o) throws Throwable {
   Event response = (Event)o;
   if (response != null && response.getThrowable() != null) {
   AbstractSpan span = ContextManager.activeSpan();
   span.log(response.getThrowable());
   span.errorOccurred();
   }
   ContextManager.stopSpan();
   return o;
   }
   
   @Override
   public void handleMethodException(EnhancedInstance enhancedInstance, 
Method method, Object[] objects, Class[] classes, Throwable throwable) {
   AbstractSpan activeSpan = ContextManager.activeSpan();
   activeSpan.errorOccurred();
   activeSpan.log(throwable);
   }
   }
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错

2018-05-30 Thread GitBox
yrjjf commented on issue #1297: tiny框架插件开发,遇到探针启动报错
URL: 
https://github.com/apache/incubator-skywalking/issues/1297#issuecomment-393404492
 
 
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   # http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
   
tiny-rpc-3.4.7=com.hsjry.monitor.sw.client.agent.define.TinyRPCInstrumentation
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services