preface

We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows :

  1. Environment building
  2. Service split
  3. Customer service
  4. Product service
  5. Order service
  6. Payment services
  7. RPC service Auth verification
  8. Service monitoring
  9. Link tracking ( this paper )
  10. Distributed transactions

I hope this series will take you to use it locally Docker Environmental utilization go-zero Quickly develop a mall system , Let you get started with micro services quickly .

Complete sample code :https://github.com/nivin-studio/go-zero-mall

First , Let's take a look at the overall service split diagram :

9.1 Jaeger Introduce

Jaeger yes Uber Develop and open source a distributed tracking system , compatible OpenTracing API, For the following scenarios :

  • Distributed tracking information transfer
  • Distributed transaction monitoring
  • Problem analysis
  • Service dependency analysis
  • performance optimization

Jaeger The full link tracking function of is mainly completed by three roles :

  • client: Be responsible for the timing of each call point on the whole chain 、 sampling , And will tracing The data is sent locally agent.
  • agent: Responsible for collection client It's from tracing data , And thrift The agreement is forwarded to collector.
  • collector: Responsible for collecting all agent Reported tracing data , Unified storage .

9.2 go-zero  Use  Jaeger  Link tracking

go-zero  The framework has helped us realize link tracking ( See :go-zero Link tracking ), And the integration supports Jaeger, Zipkin These two link tracking and reporting tools , We just need a simple configuration , You can visually view the complete call chain of a request , And the call and performance of each link .

9.2.1 add to user api service Telemetry To configure

$ vim mall/service/user/api/etc/user.yaml
Name: User
Host: 0.0.0.0
Port: 8000 ... Telemetry:
Name: user.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.2 add to user rpc service Telemetry To configure

$ vim mall/service/user/rpc/etc/user.yaml
Name: user.rpc
ListenOn: 0.0.0.0:9000 ... Telemetry:
Name: user.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.3 add to product api service Telemetry To configure

$ vim mall/service/product/api/etc/product.yaml
Name: Product
Host: 0.0.0.0
Port: 8001 ... Telemetry:
Name: product.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.4 add to product rpc service Telemetry To configure

$ vim mall/service/product/rpc/etc/product.yaml
Name: product.rpc
ListenOn: 0.0.0.0:9001 ... Telemetry:
Name: product.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.5 add to order api service Telemetry To configure

$ vim mall/service/order/api/etc/order.yaml
Name: Order
Host: 0.0.0.0
Port: 8002 ... Telemetry:
Name: order.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.6 add to order rpc service Telemetry To configure

$ vim mall/service/order/rpc/etc/order.yaml
Name: order.rpc
ListenOn: 0.0.0.0:9002 ... Telemetry:
Name: order.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.7 add to pay api service Telemetry To configure

$ vim mall/service/pay/api/etc/pay.yaml
Name: Pay
Host: 0.0.0.0
Port: 8003 ... Telemetry:
Name: pay.api
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

9.2.8 add to pay rpc service Telemetry To configure

$ vim mall/service/pay/rpc/etc/pay.yaml
Name: pay.rpc
ListenOn: 0.0.0.0:9003 ... Telemetry:
Name: pay.rpc
Endpoint: http://jaeger:14268/api/traces
Sampler: 1.0
Batcher: jaeger

Tips : After configuration modification , You need to restart the service to take effect .

9.3 Use  Jaeger UI  View link

  • visit /api/user/userinfoapi Interface

  • stay Chapter one Environment building We integrated  Jaeger  service , And for it Jaeger UI Port number 16686 Made the host port 5000 The mapping relation of , So enter... In the browser  http://127.0.0.1:5000/  visit  Jaeger UI  Interface . choice Search menu , stay Service Select from the drop-down box user.api, Finally, click Find Traces Button , You can query the just accessed /api/user/userinfo Link tracking data of the interface .

  • Click in , You can see this /api/user/userinfo Link sequence diagram of interface , And service dependencies , And time consuming .

  • Different data display styles can be selected from the drop-down menu in the upper right corner .

  • Effect drawing of other interface link tracking

Project address

https://github.com/zeromicro/go-zero

Welcome to use go-zero and star Support us !

WeChat ac group

Focus on 『 Microservice practice 』 Official account and click Communication group Get community group QR code .

Take you ten days to easily finish Go Micro service series ( Nine 、 Link tracking ) More articles about

  1. Take you ten days to easily finish Go Micro service series ( One )

    This article begins , We will publish a series of articles to show you one in detail go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building ( this paper ) Service split Customer service Product service Order service Payment services RPC service Au ...

  2. Take you ten days to easily finish Go Micro service series ( Two )

    The last article begins with , We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split ( this paper ) Customer service Product service Order service Payment services RPC service ...

  3. Take you ten days to easily finish Go Micro service series ( 3、 ... and )

    preface We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split Customer service ( this paper ) Product service Order service Payment services RPC service Auth ...

  4. Take you ten days to easily finish Go Micro service series ( 5、 ... and )

    preface We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split Customer service Product service Order service ( this paper ) Payment services RPC service Auth ...

  5. Take you ten days to easily finish Go Micro service series ( 6、 ... and )

    preface We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split Customer service Product service Order service Payment services ( this paper ) RPC service Auth ...

  6. Take you ten days to easily finish Go Micro service series ( 7、 ... and )

    preface We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split Customer service Product service Order service Payment services RPC service Auth verification ( ...

  7. Take you ten days to easily finish Go Micro service series ( 8、 ... and 、 Service monitoring )

    preface We will show you one in detail through a series of articles go-zero Microservice example , The whole series is divided into ten articles , The directory structure is as follows : Environment building Service split Customer service Product service Order service Payment services RPC service Auth verification ...

  8. 【 Microservices 】 The second : Starting from scratch , Easy to handle SpringCloud Micro service series -- Registry Center ( One )

    Micro service system , Effectively solve the huge project . The problem of interdependence . at present SpringCloud The system has a powerful set of solutions for micro services . In this paper , This paper focuses on the service discovery registry in the micro service system . The registry in this article , use Netf ...

  9. Starting from scratch , Easy to handle SpringCloud Micro service series

    Contents of this series of blog articles [ Microservices ] One of : Starting from scratch , Easy to handle SpringCloud Micro service series – The beginning of the mountain (spring boot Small demo) [ Microservices ] The second : Starting from scratch , Easy to handle SpringCloud Micro service series – notes ...

  10. 【 Microframets 】 One of : Starting from scratch , Easy to handle SpringCloud Micro service series -- The beginning of the mountain (spring boot Small demo)

    Spring There are many top-level frameworks , So the following space , I'll focus on SpringCloud Implementation of the micro framework Spring Top projects , Contains a lot of , Let's focus on ,SpringCloud Project and SpringBoot project ...

Random recommendation

  1. 160 individual crackme- And Afkayas.1

    Tools : OD Environmental Science : windows XP function : Let's run this small program first , See what it does . After running, it found that it asked us to enter Type In your Name and Type In your Serial ...

  2. Oracle IF & CASE sentence

    IF Statements mainly have the following three basic forms : One . IF-THEN sentence IF CONDITION THEN           STATEMENT 1;           ...           STATE ...

  3. 20 It's fashionable WordPress Blog theme 【 As a free download 】

    In this article , We have collected 20 It's fashionable  WordPress  Blog templates .WordPress As the most popular blogging system , There are many plug-ins , Easy to expand functions . It's very easy to install and use , And there are many free templates developed by third parties , Simple installation ...

  4. Java Map Interface

    Map Interface mapping unique key value . One key is , To retrieve a value object in the future . Give a key and a value , Can be in a Map The value stored by the object . When the value after is stored , You can use its keys to retrieve . Throw a NoSuchElementExcepti ...

  5. ACM - ICPC World Finals 2013 D Factors

    Download :http://icpc.baylor.edu/download/worldfinals/problems/icpc2013.pdf Topic translation : Problem description One of the most basic arithmetic rules is greater than 1 The integer of ...

  6. Mac Next Apache Server configuration

    One .Apache The server 1. The most widely used Web The server 2. Mac Bring their own , You only need to modify a few configurations , Simple , quick 3. There are some special server functions ,Apache All of them can support Purpose : Let's have our own test ring ...

  7. Liu Zhimei 2017710101152《 Object oriented programming (java)》 Week 10 learning summary

    Experiment 10    Generic programming techniques Experiment time 2018-11-1 1. The purpose and requirements of the experiment (1) Generic programming : It means that the code can be reused by many different types of objects .(ArrayList Class can aggregate objects of any type ) If in ...

  8. java web session Be overdue The jump page does not jump out frame The problem of

    about frame Page frame java web project , If session When performing jump operation after expiration , Only in one frame in ( for example center frame) Jump to the set login Page , In order to jump directly to the initial login page , Just ...

  9. uniGUI Dynamic establishment Form And release

    uniGUI Dynamic establishment Form And release (2015-10-01 14:51:12) Reprint ▼   classification : uniGUI use uniGUI Development of the project , It is inevitable to encounter dynamic establishment Form, And then release , With the traditional Delph ...

  10. JS Get system time --JavaScript Basics

    1. The current time is displayed in real time in the web page <!DOCTYPE html><html lang="en"><head> <meta charset=&qu ...