对于Web端:
  1. 需要在applicationContext的头部添加中添加prefix引用:

xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="...http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"

2. 添加dubbo的过滤器(可以和webhttpTracing公用一个Tracing)
 <dubbo:consumer filter="tracing" />

3. 在pom中添加dubbo rpc的引用

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-bom</artifactId>
<version>${brave.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>y <dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-spring-beans</artifactId>
</dependency> <dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-context-log4j12</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-spring-web</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-dubbo-rpc</artifactId>
</dependency>

在Provider端:
1. applicationContext.xml文件(或者自定义的bean文件)中添加prefix引用以及添加tracing bean:

xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="...http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
 <bean id="tracing" class="brave.spring.beans.TracingFactoryBean">
<property name="localServiceName" value="rpc-double" />
<property name="spanReporter">
<bean class="zipkin2.reporter.beans.AsyncReporterFactoryBean">
<property name="encoder" value="JSON_V2" />
<property name="sender">
<bean class="zipkin2.reporter.beans.URLConnectionSenderFactoryBean">
<property name="endpoint" value="http://10.4.120.77:9411/api/v2/spans" />
</bean>
</property>
<!-- wait up to half a second for any in-flight spans on close -->
<property name="closeTimeout" value="500" />
</bean>
</property>
<property name="propagationFactory">
<bean id="propagationFactory" class="brave.propagation.ExtraFieldPropagation"
factory-method="newFactory">
<constructor-arg index="0">
<util:constant static-field="brave.propagation.B3Propagation.FACTORY" />
</constructor-arg>
<constructor-arg index="1">
<list>
<value>user-name</value>
</list>
</constructor-arg>
</bean>
</property>
<property name="currentTraceContext">
<bean class="brave.context.log4j12.MDCCurrentTraceContext"
factory-method="create" />
</property>
</bean>

2. 添加tracing bean

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-bom</artifactId>
<version>${brave.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-spring-beans</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-spring-beans</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-urlconnection</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-instrumentation-dubbo-rpc</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave-context-log4j12</artifactId>
</dependency>

下午卡在了一个问题,迁移dubbo到一个单独的工程就是找不到zipkin.Endpoint;
扒拉源码也没有;后来才发现原来在dubbo的工程里面的parent中有一个io.zipkin.java.zipkin里面有这个类(之前接触的都是io.zipkin.zipkin)。坑啊。

zipkin对于dubbo的支持的更多相关文章

  1. 服务化改造实践 | 如何在 Dubbo 中支持 REST

    什么是 REST REST 是 Roy Thomas Fielding [[1]](#fn1) 在 2000 年他的博士论文 [[2]](#fn2) “架构风格以及基于网络的软件架构设计” 中提出来的 ...

  2. Dubbo如何支持本地调用?injvm方式解析

    Dubbo是一个远程调用的框架,对于一个服务提供者,暴露了一个接口供外部消费者调用,那么对于提供者自己是否可以调用这个接口,需要什么特殊处理吗? 这篇文章就分享下Dubbo关于本地调用的实现机制,以及 ...

  3. Dubbo多协议支持

    除了Dubbo服务暴露协议Dubbo协议外,Dubbo框架还支持另外8种服务暴露协议:RMI协议.Hessian协议.HTTP协议.WebService协议.Thrift协议.Memcached协议. ...

  4. 原理分析dubbo分布式应用中使用zipkin做链路追踪

    zipkin是什么 Zipkin是一款开源的分布式实时数据追踪系统(Distributed Tracking System),基于 Google Dapper的论文设计而来,由 Twitter 公司开 ...

  5. TarsGo新版本发布,支持protobuf,zipkin和自定义插件

    本文作者:陈明杰(sandyskies) Tars是腾讯从2008年到今天一直在使用的后台逻辑层的统一应用框架,目前支持C++,Java,PHP,Nodejs,Golang语言.该框架为用户提供了涉及 ...

  6. dubbo支持协议及具体对比

    对dubbo的协议的学习,可以知道目前主流RPC通信大概是什么情况,本文参考dubbo官方文档 http://dubbo.io/User+Guide-zh.htm dubbo共支持如下几种通信协议: ...

  7. 原理分析dubbo分布式应用中使用zipkin做链路追踪(转)

    作者:@nele本文为作者原创,转载请注明出处:https://www.cnblogs.com/nele/p/10171794.html 目录 zipkin是什么为什么使用Zipkinzipkin架构 ...

  8. Dubbo 在跨语言和协议穿透性方向的探索:支持 HTTP/2 gRPC

    Dubbo 在跨语言和协议穿透性方向上的探索:支持 HTTP/2 gRPC 和 Protobuf 本文整理自刘军在 Dubbo 成都 meetup 上分享的<Dubbo 在多语言和协议穿透性方向 ...

  9. dubbo 相关面试题 有用

    调用关系说明: · 0. 服务容器负责启动,加载,运行服务提供者. · 1. 服务提供者在启动时,向注册中心注册自己提供的服务. · 2. 服务消费者在启动时,向注册中心订阅自己所需的服务. · 3. ...

随机推荐

  1. js 逗号操作符

    有一道js面试题,题目是这样的:下列代码的执行结果是什么,为什么? var i, j, k; for (i=0, j=0; i<10, j<6; i++, j++) { k = i+j; ...

  2. Java实现:数据结构之排序

    Java实现:数据结构之排序 0.概述 形式化定义:假设有n个记录的序列(待排序列)为{ R1, R2 , -, Rn },其相应的关键字序列为 { K1, K2, -, Kn }.找到{1,2, - ...

  3. 解决use -D_SCL_SECURE_NO_WARNINGS的问题

    加入预处理器(项目属性----C/C++----预处理----预处理器定义): _SCL_SECURE_NO_WARNINGS

  4. Linux下停止没有关闭的远程登陆终端

    脚本如下: #!/bin/shTTY_LOG=tty_logTTY_LOG1=tty_log1USER_NAME=`whoami`#echo ${USER_NAME}who|grep ${USER_N ...

  5. Java多线程,线程交替执行

    两个线程,一个打印1-100的奇数,一个打印1-100的偶数:要求:线程1打印5个之后,线程2开始打印,线程2打印5个之后,线程1再开始打印,以此循环. Code: package com.qhong ...

  6. cf 429 B Working out

    B. Working out time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  7. Message: dlopen failed for module ‘x’: file not found

    这是未安装bochs-x的缘故 解决方案: sudo apt-get install bochs以后接着安装bochs-x. sudo apt-get install bochs-x 2.bx_dbg ...

  8. python 作用域,命名空间

    def scope_test(): def do_local(): spam = "local spam" def do_nonlocal(): nonlocal spam spa ...

  9. Intel IDEA 2018破解(亲测成功)

    破解网址:https://jingyan.baidu.com/article/cb5d6105d9b1b1005d2fe074.html

  10. SQL语言的增删改查

    select(查), update(改), delete(删), insert into(增)   select * from table_name 获取表中所有字段 select id, name, ...