. Netcore using Zipkin to monitor service performance

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.