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

网站设计师的岗位职责小红书推广方案

网站设计师的岗位职责,小红书推广方案,偷别人的WordPress主题,手机扁平化网站模版前段时间同事问我,我们录制的流量中,尤其是dubbo的子调用显示经常他的末尾会带上一个小尾巴这个是什么意思呢,其实之前我没有太在意这个事情,只是同事这么疑问了,确实激起了好奇心,所以就差了下 到底是什么…

前段时间同事问我,我们录制的流量中,尤其是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()) 完成的。 所以这的参数按照前面截图的来看的话,

  1. InvokeType.DUBBO.name()dubbo,

  2. interfaceName 则是 com.xx.xx.api.service.UserAgreementApiService

  3. 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 了, 然后取这里的第一个字符。

  4. getExtra() 暂时位置,看着是http的query的字段, 不过看到所有的录制的子调用录制逻辑基本都是null, 我们这里暂时就先忽略了。

那我们就直接看下Identity 的构造函数是怎么样的吧。

public Identity(String scheme, String location, String endpoint, Map<String, 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.Entry<String, 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/601852/

相关文章:

  • 做效果图有哪些网站seo点击排名
  • 网络营销推广网站收录seo推广排名平台有哪些
  • 产品经理如何看待网站开发广州软件系统开发seo推广
  • wordpress 忘记管理员如何做网站seo
  • app和网站哪个有优势淘宝关键词排名
  • wordpress该域名宁波网站seo公司
  • 建购物网站怎么建呀简单的网站建设
  • 江苏省建设教育协会网站首页百度知道合伙人答题兼职入口
  • 做优化的网站平台搭建
  • 做网站需要多久网络推广是什么专业
  • 厦门加盟网站建设线上推广营销
  • 定制网站案例seo搜索引擎优化薪酬
  • 网站制作成功后怎么使用浏览器观看b站视频的最佳设置
  • 一家专门做开网店的网站北京seo专员
  • 专业企业网站搭建服务头条权重查询
  • 去哪儿网站上做民宿需要材料免费的黄冈网站有哪些平台
  • 网站建设网现在推广什么app最挣钱
  • 嘉兴装修公司做网站安装百度到桌面
  • 电商网站特点外贸营销网站建站
  • 上海市住房城乡建设管理委员会网站网络营销软文范例大全800
  • 莱芜区政协网站做网络优化的公司排名
  • 太原网站建设开发公司电商运营基本知识
  • php做企业网站seo网站推广企业
  • 万网网站备案授权书免费发布推广信息的b2b
  • 乡镇可以做门户网站seo是什么意思职业
  • 建设银行网站优点做个公司网站大概多少钱
  • 网站标题的设置方法哪家建设公司网站
  • 网站空间托管电商平台的营销方式
  • 网站制作专业的公司有哪些seo网站编辑是做什么的
  • wordpress 分栏seo怎么优化简述