当前位置: 首页 > news >正文

栖霞建设网站给一个免费的网站

栖霞建设网站,给一个免费的网站,广州网站建设报价表,品牌营销公司排名前段时间同事问我#xff0c;我们录制的流量中#xff0c;尤其是dubbo的子调用显示经常他的末尾会带上一个小尾巴这个是什么意思呢#xff0c;其实之前我没有太在意这个事情#xff0c;只是同事这么疑问了#xff0c;确实激起了好奇心#xff0c;所以就差了下 到底是什么… 前段时间同事问我我们录制的流量中尤其是dubbo的子调用显示经常他的末尾会带上一个小尾巴这个是什么意思呢其实之前我没有太在意这个事情只是同事这么疑问了确实激起了好奇心所以就差了下 到底是什么 我们先看下是什么样的现象 如下图所示 如上 这里就会跟上一个~AP 的小尾巴那这个到底是什么意思呢是某个hash的结果吗要了解这个其实也不难我们就看下dubbo子调用的identity是怎么赋值的就好了。所以我们来看下具体的逻辑 在录制过程中事件过来的时候如果是Before的情况下就会进入如下内容 protected void doBefore(BeforeEvent event) throws ProcessControlException {// 回放流量如果是入口则放弃子调用则进行mockif (RepeatCache.isRepeatFlow(Tracer.getTraceId())) {processor.doMock(event, entrance, invokeType);return;}Invocation invocation initInvocation(event);invocation.setStart(System.currentTimeMillis());invocation.setTraceId(Tracer.getTraceId());invocation.setIndex(entrance ? 0 : SequenceGenerator.generate(Tracer.getTraceId()));invocation.setIdentity(processor.assembleIdentity(event));invocation.setEntrance(entrance);invocation.setType(invokeType);invocation.setProcessId(event.processId);invocation.setInvokeId(event.invokeId);invocation.setRequest(processor.assembleRequest(event));invocation.setResponse(processor.assembleResponse(event));invocation.setSerializeToken(ClassloaderBridge.instance().encode(event.javaClassLoader));try {// fix issue#14 : useGeneratedKeysif (processor.inTimeSerializeRequest(invocation, event)) {SerializerWrapper.inTimeSerialize(invocation);}} catch (SerializeException e) {Tracer.getContext().setSampled(false);log.error(Error occurred serialize, e);}RecordCache.cacheInvocation(event.invokeId, invocation); }所以identity 是经过各自的子调用处理器处理后生成的标识。这里我们具体的就是dubbo的调用所以我们看下 DubboConsumerInvocationProcessor 的逻辑 public Identity assembleIdentity(BeforeEvent event) {Object invoker;Object invocation;if (ON_RESPONSE.equals(event.javaMethodName)) {// for record identity assemble// onResponse(Result appResponse, Invoker? invoker, Invocation invocation) {}invoker event.argumentArray[1];invocation event.argumentArray[2];} else {// for repeater identity assemble// invoke(Invoker? invoker, Invocation invocation)invoker event.argumentArray[0];invocation event.argumentArray[1];}try {// methodNameString methodName (String) MethodUtils.invokeMethod(invocation, getMethodName);Class?[] parameterTypes (Class?[]) MethodUtils.invokeMethod(invocation, getParameterTypes);// interfaceNameString interfaceName ((Class)MethodUtils.invokeMethod(invoker, getInterface)).getCanonicalName();return new Identity(InvokeType.DUBBO.name(), interfaceName, getMethodDesc(methodName, parameterTypes), getExtra());} catch (Exception e) {// ignoreLogUtil.error(error occurred when assemble dubbo request, e);}return new Identity(InvokeType.DUBBO.name(), unknown, unknown, null); }我们看到Identity 直接就是通过 new Identity(InvokeType.DUBBO.name(), interfaceName, getMethodDesc(methodName, parameterTypes), getExtra()) 完成的。 所以这的参数按照前面截图的来看的话 InvokeType.DUBBO.name() 即 dubbo, interfaceName 则是 com.xx.xx.api.service.UserAgreementApiService getMethodDesc(methodName, parameterTypes) 这个看了下实现原来就是我们一直在寻找的带小尾巴的原因了 我们来看下。 protected String getMethodDesc(String methodName, Class?[] parameterTypes) {StringBuilder builder new StringBuilder(methodName);if (parameterTypes ! null parameterTypes.length 0) {builder.append(~);for (Class? parameterType : parameterTypes) {String className parameterType.getSimpleName();builder.append(className.subSequence(0, 1));}}return builder.toString();}我们可以看到它这里就是就是在拼接方法跟参数类型不过他没有拿参数类型的所有内容而是参数类型的类名比如说 Java.lang.String 结果就是string 了 然后取这里的第一个字符。 getExtra() 暂时位置看着是http的query的字段 不过看到所有的录制的子调用录制逻辑基本都是null, 我们这里暂时就先忽略了。 那我们就直接看下Identity 的构造函数是怎么样的吧。 public Identity(String scheme, String location, String endpoint, MapString, String extra) {this.scheme scheme;this.location location;this.endpoint endpoint;this.extra extra;StringBuilder sb new StringBuilder();sb.append(scheme).append(HOST_SPLITTER).append(Joiner.on(/).join(location, endpoint));if (extra ! null !extra.isEmpty()) {boolean firstKey true;for (Map.EntryString, String entry : extra.entrySet()) {if (firstKey) {firstKey false;sb.append(QUERY_STRING_COLLECTOR);} else {sb.append(KEY_VALUE_SPLITTER);}sb.append(entry.getKey()).append(KEY_VALUE_COLLECTOR).append(entry.getValue());}}this.uri sb.toString();}可以看到构造函数里面的逻辑其实重点是在构造一个uri, 而这个uri 应该就是我们最开始截图的时候看到的identity的内容了。 其实就是通过各个分隔符连接起来构成我们传参进来的数据。
http://www.hkea.cn/news/14507250/

相关文章:

  • 网站前置审批类型企业网站模板整套
  • 管庄地区网站建设优化大师官方下载
  • 青岛网站建设开发外包小程序开发平台排名
  • 镇江企业做网站你注册过的那些网站
  • 开源展示型网站百度快照是什么意思?
  • 男女做那个网站动态图怎么申请专线访问国际网络
  • 湛江专业建站孝感建设银行官网站
  • 自己做网站的视频最全的游戏网站
  • 网站功能建设中网站关键词布局
  • 深圳网站建设制作企业建筑公司企业使命和愿景大全
  • 网站开发的套路卖源码的网站
  • 郑州市金水区建设局网站火星人网页设计培训
  • 济南网站网站建设wordpress头像多说
  • 开源的企业网站管理系统特效素材库免费素材网
  • 竹子网站建站深圳市seo网站设计哪家好
  • 浙江城乡建设部网站首页网站备案号是什么
  • 福建宁德建设局网站网站备案号代码
  • 网站建设行业政策网站设计策划书 模板
  • 陕西网站开发公司wordpress应用引入的js
  • 有哪些网站可以免费做推广网站停留时间 从哪里获取
  • wordpress多站点配置教程值得相信的西安网站开发
  • 网站整体设计意图及其功能东莞房价会跌吗
  • 沈阳住房和城乡建设厅网站简述一下网站的设计流程
  • 服务器备案期间网站装饰协会网站源码
  • 名校建设网站微信免费下载2023新版
  • 在线空间设计超级seo企业网站系统
  • 徐州网站建设市场分析如何选择品牌网站建设
  • 西安网站开发公司有哪家做网站登入见面
  • 网站支付宝支付接口申请wordpress侧边栏折叠
  • 网站开发电脑设置平台公司经营范围