Integrate end-to-end tracing

Updated at:

Integrate end-to-end tracing with your scheduled tasks to query task execution duration and analyze execution exceptions. In distributed microservices scenarios, the call chain of a scheduled task is often longer than that of a real-time service, and tracing visualization shows how each service node in the chain runs.

Limits

End-to-end tracing is supported only for the following task types: standalone tasks (including HTTP tasks), broadcast tasks, and visualized Map tasks. Confirm that your task type is supported before you configure the integration.

Prerequisites

Step 1: Choose an integration method

Your deployment mode and tracing backend determine how the application reports trace data and which trace plugin you add in Step 2. Choose the method that matches your current setup:

Your current setupMethod
The application already runs on EDAS.Option 1 (recommended)
The application runs outside EDAS, and you use ARMS as the tracing backend.Option 2
You already run a self-managed tracing platform, such as SkyWalking.Option 3

Option 1: Deploy the application on EDAS (recommended)

Use this method if your application services already run on EDAS, or if you plan to deploy them on EDAS. Applications deployed on EDAS integrate end-to-end tracing automatically, so no agent installation is required.

  • If you already use EDAS to deploy your application services, end-to-end tracing is already integrated. Skip the deployment steps in this section.

  • If you do not use EDAS yet, activate EDAS and deploy your application on it. Applications deployed on EDAS integrate end-to-end tracing without extra configuration. For instructions, see Get started with EDAS.

Option 2: Install the ARMS agent on a standalone deployment

Use this method if you deploy the application yourself and use ARMS as the tracing backend. Complete the following steps in the ARMS application integration process:

  1. Download the required JAR package as prompted.

  2. Configure the corresponding application information.

  3. Add the ARMS Java agent configuration to the startup script of the application.

  4. Start the application. The integration takes effect after startup.

For instructions, see Manually install the ARMS agent.

Option 3: Connect a self-managed tracing platform

Use this method if you already run a self-managed end-to-end tracing platform. The following steps use SkyWalking, a common self-managed platform.

  1. Download the SkyWalking agent installation package and complete the configuration.

  2. Add the following JVM parameter to the startup script of the Java application: -javaagent:{agent.path}/skywalking-agent.jar.

  3. When you add the trace plugin dependency in Step 2, use the SkyWalking plugin instead of the OpenTelemetry plugin, as shown in the following example.

    <dependency>
        <groupId>com.aliyun.schedulerx</groupId>
        <artifactId>schedulerx-plugin-trace-skywalking</artifactId>
        <version>{latest_version}</version>
    </dependency>

Step 2: Add the trace plugin dependency

Add the dependencies to the pom.xml file of your application. The following example uses the Spring Boot starter with the OpenTelemetry trace plugin. If you connect a self-managed SkyWalking platform (Option 3), use the SkyWalking trace plugin instead.

<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx2-spring-boot-starter</artifactId>
  <version>{latest_version}</version>
  <!-- If you use logback, exclude log4j and log4j2. -->
  <exclusions>
    <exclusion>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
    </exclusion>
    <exclusion>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<!-- Add the OpenTelemetry trace plugin dependency. -->
<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx-plugin-trace-opentelemetry</artifactId>
  <version>{latest_version}</version>
</dependency>
<!-- If you use SkyWalking, use this plugin instead. -->
<!--<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx-plugin-trace-skywalking</artifactId>
  <version>{latest_version}</version>
</dependency>-->

Step 3: View call chains

After you complete the preceding configuration and application deployment, end-to-end tracing visualization is available when a scheduled task of a supported type runs. Run the task, and then use the following procedure to open its call chain in the console.

Note

End-to-end trace data collection uses a default sampling rate, so not every call chain is collected. You can set the sampling rate based on your business scenario.

  1. Log on to the MSE SchedulerX console.

  2. In the top menu bar, select a region.

  3. In the left-side navigation pane, click Execution List, select the Task instance List tab, and then use the path for your task type in the Actions column.

Standalone tasks

Either click Tracing Analysis, or click Details and then click the TraceId, to open the call chain of that execution. Standalone HTTP tasks are also supported, because the application to which the service belongs is deployed with the end-to-end tracing capability (with OpenTelemetry support).

Broadcast tasks

Click Details. On the Task instance details page, click Current execution details. A TraceId is displayed for each machine. Click a TraceId to view the call chain of that machine.

Visualized Map tasks

Click Details. On the Task instance details page, click Subtask list. Visualized Map tasks provide call chain visualization for each subtask in an execution record. In the subtask list of the execution record details, view the TraceId of each subtask and click it to view the call chain of that subtask.