Giter VIP home page Giter VIP logo

lifeix-zipkin-client's Introduction

lifeix-zipkin-client

java使用zipkin,这个client主要基于https://github.com/kristofa/brave 作出小的改动,确保调用zipkin服务功能不会受到影响。

1.修改ZipkinSpanCollector中collect方法,队列满后直接丢弃,不再阻塞等待。
2.修改ZooKeeperSamplingTraceFilter,增加连接zookeeper等待超时时间;增加sampleRate为double处理。
3.对调用做了简单的封装,保证调用服务在zipkin相关服务出现问题时不影响调用服务的正常功能。

打包: mvn clean package

调用:

//Init zipkin
ZipKinConfig zkConfig = new ZipKinConfig();
zkConfig.setTraceServerIp("127.0.0.1");
zkConfig.setTraceServerPort(8080);
zkConfig.setTraceServerName("ServiceName");
zkConfig.setCollectorServerIp("127.0.0.1");
zkConfig.setCollectorServerPort(9410);
zkConfig.setSpanQueueSize(150);
zkConfig.setZkServerConnectString("127.0.0.1:2181");
zkConfig.setSampleRateNode("/zipkin/config/samplerat");
ZipkinCollectorClient.getInstance().init(zkConfig);

//Begin tracer
ZipkinCollectorClient tracer = ZipkinCollectorClient.getInstance();
tracer.startNewSpan("timeline");
tracer.setClientSent();

//Your code here
tracer.setClientReceived();

//Shutdown
ZipkinCollectorClient.getInstance().shutdown();

lifeix-zipkin-client's People

Contributors

pengkw avatar

Watchers

James Cloos avatar 胡鹏飞 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.