Resources
https://zipkin.io/
https://github.com/openzipkin/zipkin/
Https://github.com/d-collab/zipkin.net
Build the Environment
CentOS 7.X
Java 8 SDK
Zipkin official website has three kinds of installation methods can be referenced
Docker
9411:9411 Openzipkin/zipkin
Java
If you already have a JAVA8 environment can be installed as follows
Curl-ssl https://zipkin.io/quickstart.sh | bash-sJava-jar Zipkin.jar
SOURCE Installation
git clone https://github.com/openzipkin/zipkincd Zipkin. /mvnw-dskiptests--also-makeinstall-jar./zipkin-server/target/zipkin-server-* Exec.jar
After installation, visit the following address to see the Zipkin effect.
. How to use Zipkin in Netcore
First add the following 2 NuGet packages
In order not to make the Configure method too bloated, I'm going to expand the Iapplicationbuilder interface I need to use here.
Inject Iapplicationlifetime, iloggerfactory two objects into the Configure
App. Userzipkincore (Applicationlifetime, loggerfactory);
Public Static voidUserzipkincore ( Thisiapplicationbuilder app,iapplicationlifetime applicationlifetime,iloggerfactory loggerFactory) {ApplicationLifetime.ApplicationStarted.Register ()={tracemanager.samplingrate=1.0f; varLogger =NewTracinglogger (Loggerfactory,"zipkin4net"); varHttpsender =NewHttpzipkinsender ("http://ipaddress:9411","Application/json"); varTracer =NewZipkintracer (Httpsender,NewJsonspanserializer ()); Tracemanager.registertracer (tracer); Tracemanager.start (logger); }); ApplicationLifetime.ApplicationStopped.Register (()=tracemanager.stop ()); App. Usetracing ("IdentityServer4"); }
Samplingrate: Granularity of trace logs
Usetracing: New service name on Zipkin
Start the reference program to view the records in Zipkin
About the interface function of Zipkin do not make a special introduction to see all understand
. Netcore using Zipkin to monitor service performance