Community Blog Visualizing Service Tracing Analysis for Microservices

Visualizing Service Tracing Analysis for Microservices

In this example, we introduce how to visualize service tracing analysis for two Spring Cloud-based microservices with Spring Cloud Sleuth and Zipkin in Java.

Imagine the following scenario: if your microservices grow gradually and the dependencies between services become increasingly complicated, how can you analyze the call relations and mutual influences between them?

An application comprised of microservices divides the problem domain through services and completes the operation through REST API to connect services. An entry service call may require the coordination of multiple background services. Any call timeout or error on the link may lead to the failure of the front-end requests. The call chain of the service will become longer and longer, and form a tree-shaped call chain.

With the increasing services, the analysis on the call chain will become more and more detail-oriented. Suppose you are in charge of the system below, and every small point in it is a microservice. The call relations between the microservices constitute the complicated network. The service calling chains and dependencies between services can be analyzed in a visualized way.

The open-source implementation corresponding to Dapper is Zipkin. It supports multiple languages including JavaScript, Python, Java, Scala, Ruby, C# and Go. Among them, Java supports different databases.

In this example, we prepare to develop two Spring Cloud-based applications and use Spring Cloud Sleuth to integrate with Zipkin.

In this example there are two demo services: tracedemo, acting as the frontend service to receive requests from users; and tracebackend, acting as the backend service. The tracedemo calls the backend service through the HTTP protocol. The tracedemo application calls the backend tracebackend service through RestTemplate and the backend service responds to the HTTP request.

This is a typical access from two Spring applications through RestTemplate. And in this example, Gradle is used to build applications. JAR packages related to Sleuth and Zipkin are loaded in build.gradle.

After the Spring application detects Sleuth and Zipkin in Java dependent packages, it will automatically inject tracing information to the HTTP request during RestTemplate calls, and send the information to the Zipkin Server.

Create two identical Dockerfiles for these two services to generate the Docker image:

FROM java:8-jre-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories
ADD build/libs/*.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

Introduce Zipkin dependent package in build.gradle.

dependencies {

Then you can add an annotation @EnableZipkinServer in the main program class, specify the port as 9411 in application.properties, build a docker image and deploy it on Alibaba Cloud Docker to create an application.

For details about how to integrate Zipkin and Spring Cloud to visualize the service tracing analysis, you can go to Service Tracing Analysis on Spring Cloud Applications Using Zipkin.

Related Blog Posts

Deploy an Application to Alibaba Cloud EDAS in Eclipse

Enterprise Distributed Application Service (EDAS) is a PaaS platform involving applications and microservices. It provides a variety of application release capabilities and lightweight microservice solutions that can help you solve monitoring, diagnostics, and high-availability O&M issues in your application and service management processes. EDAS is available in the Spring Cloud and Dubbo environments.

In this article, we will explain how to deploy Java applications to Alibaba Cloud EDAS in Eclipse.

Dubbo Metrics: Exploring the Measurement and Statistics Infrastructure of Dubbo

Real-time monitoring of services to understand the current operational metrics and health status of services is an indispensable part in the microservice system. Metrics, as an important component of microservices, provides a comprehensive data base for service monitoring. Recently, Dubbo Metrics version 2.0.1 was released. This article reveals the origins of Dubbo Metrics and the 7 major improvements.

Dubbo Metrics (formerly Alibaba Metrics) is a widely used basic class library for metric tracking within Alibaba Group. It has two versions: Java and Node.js. Currently, Java is the open-source version.

Related Documentation

Deploy a microservice application with Helm

This topic describes two methods in which Helm can be used to deploy a microservice application in a Kubernetes cluster created by Alibaba Cloud Container Service for Kubernetes (ACK). In this topic, a PiggyMetrics application is deployed as the microservice application.

Deploy Java Web applications in ECS clusters

An ECS instance can deploy only one ECS application.To publish an ECS application is to install an EDAS container on your ECS instance and then use a WAR or JAR package to deploy the application in the EDAS container.

This topic describes how to create a Java Web application with only a welcome page in the EDAS console, and how to deploy, update, view, and manage the application with a WAR package.

Related Products

Enterprise Distributed Application Service

Enterprise Distributed Application Service (EDAS) is a PaaS platform for a variety of application deployment options and microservices solutions to help you monitor, diagnose, operate and maintain your applications.

Container Service for Kubernetes (ACK)

Container Service for Kubernetes (ACK) is a fully-managed service compatible with Kubernetes to help users focus on their applications rather than managing container infrastructure. Alibaba Cloud can schedule, orchestrate, deploy, and grayscale-release the microservice applications, and you only need to iterate these applications.

0 0 0
Share on

Alibaba Clouder

1,946 posts | 434 followers

You may also like