日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

dubbo 整合 zipkin,最简单的方式,亲测有效

發布時間:2023/12/10 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 dubbo 整合 zipkin,最简单的方式,亲测有效 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

大家好,我是烤鴨。

? ? 之前也試過網上很多版本,看了好多文章。現在分享最簡單的方式,代碼侵入性最小的。

?

1. 修改pom,引入jar。

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --> <dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.0.9.RELEASE</version> </dependency> <!--zikpin--> <!-- https://mvnrepository.com/artifact/io.zipkin.brave/brave-instrumentation-dubbo-rpc --> <dependency><groupId>io.zipkin.brave</groupId><artifactId>brave-instrumentation-dubbo-rpc</artifactId><version>5.6.8</version> </dependency> <dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-zipkin</artifactId> </dependency> <!--zikpin end -->

?

2. 下載 zipkin.jar 并啟動

wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec' nohup java -jar zipkin-server-2.12.9-exec.jar

啟動成功后訪問如圖:

?

3. 修改 yml 配置文件

?增加 zipkin相關配置,provider 和 consumer 都需要添加

spring:servlet:multipart:max-file-size: 20MBmax-request-size: 20MBenabled: truezipkin:enabled: truebase-url: http://xx.xx.xx.69:9411 #zipkin地址sender:type: web #向http發送trace信息

?provider:

? ? ? ?增加 provider.filter: 'tracing'

dubbo:application:id: etc_manage_servicename: etc_manage_serviceprotocol:port: 20883threadpool: cachedthreads: 500accepts: 1000dispatcher: messageprovider:timeout: 600000filter: 'tracing'registry:address: zookeeper://127.0.0.1:2181scan:basePackages: xxx.xxx

consumer:

? ? ? ?增加 consumer.filter: 'tracing'

dubbo:application:id: etc_manage_webname: etc_manage_webregistry:address: zookeeper://127.0.0.1:2181scan:base-packages: xxx.xxxconsumer:filter: 'tracing'

4. 啟動服務后,調用如圖:

? ??

總結:


最開始的時候,也有時候會有調用服務,但是zipkin 沒有收到請求的情況,發現是 zipkin 沒有生效,可能是引入的zipkin的包太多了,刪除不用的。
?還有zipkin的配置
?zipkin.base-url:xx
?這個地方是 base-url,不是baseUrl。
?還有就是 consumer 有記錄,但是 provider沒有。
?配置了 provider.filter 之后,又重啟了服務,之后試了幾次,就可以了。

總結

以上是生活随笔為你收集整理的dubbo 整合 zipkin,最简单的方式,亲测有效的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。