dubbo integration zipkin, the easiest way, effective pro-test

Hello everyone, I am a duck.

    Before tried many online versions, read a lot of articles. The easiest way to share now, the code is the least invasive.

 

1. Modify pom, incorporated 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. Download and start 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

After starting a successful visit as shown:

 

3. Modify yml profile

 Increase zipkin configuration, provider and consumer need to add

spring:
  servlet:
    multipart:
      max-file-size: 20MB
      max-request-size: 20MB
      enabled: true
  zipkin:
    enabled: true
    base-url: http://xx.xx.xx.69:9411  #zipkin地址
    sender:
      type: web #向http发送trace信息

 provider:

       Increase provider.filter: 'tracing'

dubbo:
  application:
    id: etc_manage_service
    name: etc_manage_service
  protocol:
    port: 20883
    threadpool: cached
    threads: 500
    accepts: 1000
    dispatcher: message
  provider:
    timeout: 600000
    filter: 'tracing'
  registry:
    address: zookeeper://127.0.0.1:2181
  scan:
    basePackages: xxx.xxx

consumer:

       Increase consumer.filter: 'tracing'

dubbo:
  application:
    id: etc_manage_web
    name: etc_manage_web
  registry:
    address: zookeeper://127.0.0.1:2181
  scan:
    base-packages: xxx.xxx
  consumer:
    filter: 'tracing'

4. After starting the service, call the figure:

    

to sum up:


The very beginning, there will also sometimes call the service, but did not receive the case zipkin request, found zipkin not entered into force, it may be too many packets zipkin introduced the delete unused.
 There zipkin configuration :
 zipkin.base-url: xx
 This place is Base-url , not baseUrl.
 There is a consumer record, but the provider did not.
 Configuring the provider.filter After that, restart the service, after a few tries it.

Published 115 original articles · won praise 58 · Views 230,000 +

Guess you like

Origin blog.csdn.net/Angry_Mills/article/details/95611637