edit-icon download-icon

Distributed tracing

Last Updated: Mar 12, 2018

EDAS now fully supports Spring Cloud applications, so you can directly deploy such applications in EDAS.

To reduce development cost and increase development efficiency, EDAS provides EagleEye, a component for service call tracing. Once EagleEye tracking is configured in the code, you can directly use the tracing function of EDAS without considering other processes including log collection, analysis, or storage.

This document introduces how to enable the distributed tracing function for your applications.

Download source code of demo: service1, service2

How to use EagleEye

Configure EDAS private server in Maven

Currently, third-party packages of Spring Cloud for Aliware are only published in the private servers of EDAS, so the configuration of private server address is required. See Maven Document for instructions on how to configure Maven and Maven private server. Download a sample file.

The address of private server is: http://edas-public.oss-cn-hangzhou.aliyuncs.com/repository

Note: Require Maven 3.x or later. Add the EDAS private server address in Maven configuration file settings.

Modify Codes

Enabling Spring Cloud application with EDAS EagleEye function requires the following three steps.

  1. Add the following common configuration in pom.xml file.

    1. <dependency>
    2. <groupId>org.springframework.cloud</groupId>
    3. <artifactId>spring-cloud-starter-eagleeye</artifactId>
    4. <version>1.1</version>
    5. </dependency>
    6. <dependency>
    7. <groupId>org.springframework.cloud</groupId>
    8. <artifactId>spring-cloud-starter-pandora</artifactId>
    9. <version>1.2</version>
    10. </dependency>
  2. Add two lines in main function. Assume that the original content of main function is as follows.

    1. public static void main(String[] args) {
    2. SpringApplication.run(ServerApplication.class, args);
    3. }

    The modified content of the main function is as follows:

    1. public static void main(String[] args) {
    2. PandoraBootstrap.run(args);
    3. SpringApplication.run(ServerApplication.class, args);
    4. PandoraBootstrap.markStartupAndWait();
    5. }
  3. Add FatJar packaging plugins.

    To package pandora-boot project into FatJar by using Maven, the following plugins should be added in pom.xml.

    To avoid conflicts with other packaging plugins, do not add other FatJar plugins in build plugin.

    1. <build>
    2. <plugins>
    3. <plugin>
    4. <groupId>com.taobao.pandora</groupId>
    5. <artifactId>pandora-boot-maven-plugin</artifactId>
    6. <version></version>
    7. <executions>
    8. <execution>
    9. <phase>package</phase>
    10. <goals>
    11. <goal>repackage</goal>
    12. </goals>
    13. </execution>
    14. </executions>
    15. </plugin>
    16. </plugins>
    17. </build>

After completing the preceding steps, you can directly use distributed tracing function of EDAS without setting up any collecting or analyzing system.

Distributed tracing example

Source code

Two application demos, service1 and service2, are provided here to demonstrate how to use distributed tracing.

service1 provides the entrances for three demonstrating scenes.

  • /rest/ok for normal calls


  • /rest/delay for calls with relatively long delay


  • /rest/error for calls with exceptions or errors


Deploy application

The collection and analysis functions of EagleEye are both set up in EDAS. To demonstrate the trace view function, we must deploy the two applications service1 and service2 in EDAS.

  1. Select a container of the latest version when creating an application.
  2. Add FatJar packaging plugins, and run the mvn clean package command under the directory of the project to create a FatJar package.
  3. Deploy the application. The application can be deployed in EDAS by uploading the FatJar application under the target directory.

To view the trace information after the deployment, calling methods corresponding to the entrances of three demonstrating scenes of service1 are required.

You can call the methods by running curl http://{$ip:$port}/rest/ok. Or you can use tools such as postman, or directly call the methods in browsers.

You are advised to repeat the calling for multiple times by using scripts and other ways for better inspection.

View a call chain

  1. Log on to the EDAS console, select Applications from the left-side navigation pane and click the name of the deployed application.
  2. Click Application Monitoring > Service Monitoring in the left-side navigation pane on the application details page.
  3. Click Provided RPC Services tab on the service monitoring page, and click View Trace.

See Service Monitoring for details.

Demo of other clients

At the same time, the automatic tracking of EagleEye for RestTemplate, AsyncRestTemplate, and FeignClient are demonstrated separately in the three URIs /echo-rest/{str}, /echo-async-rest/{str}, and /ech-feign/{str} of service1. You can view the information of each trace in the same manner.


Tracking support

Now, EagleEye of EDAS supports the automatic tracking for requests called by RestTemplate, AsyncRestTemplate, and FeignClient. We will provide the automatic tracking for more components in the future.


As AsyncRestTemplate requires to perform the modification of tracking support during class instantiation, injection of object eagleEyeAsyncRestTemplate, which supports service discovery by default, is required to enable tracing.

  1. @Autowired
  2. private AsyncRestTemplate eagleEyeAsyncRestTemplate;

FatJar packaging plugin

To package pandora-boot project into FatJar by using Maven, the pandora-boot-maven-plugin is required to be added in pom.xml. To avoid conflicts with other packaging plugins, do not add other FatJar plugins in build plugin.

Thank you! We've received your feedback.