For distributed microservices, the end-to-end tracing analysis feature enables you to analyze the execution of requests in each service in a visualized manner. For scheduled jobs, the execution path may be longer than that of common real-time services. The end-to-end tracing analysis feature can help you query the execution durations of jobs and analyze execution exceptions. This topic describes how to integrate tracing analysis with scheduled jobs.

Prerequisites

  • The agent version is 1.7.0 or later.
  • The agent depends on the Trace plug-in. For more information, see Integration configuration.
  • The application is upgraded to Professional Edition.

Integrate tracing analysis

Integration configuration

The following sample code adds a dependency to the pom.xml file of a Spring Boot application.

<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx2-spring-boot-starter</artifactId>
  <version>{Latest version}</version>
  <!-- If you use Logback, you must 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 a dependency on an extended plug-in for tracing analysis. -->
<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx-plugin-trace-opentelemetry</artifactId>
  <version>{Latest version}</version>
</dependency>
<!-- Use the following plug-in for SkyWalking. -->
<!--<dependency>
  <groupId>com.aliyun.schedulerx</groupId>
  <artifactId>schedulerx-plugin-trace-skywalking</artifactId>
  <version>{Latest version}</version>
</dependency>-->

Application deployment configuration

  • Method 1: Deploy an application in EDAS (recommended)
    • If you have already deployed an application in EDAS, the application supports tracing analysis, and you can skip application deployment in this section.
    • If you are a new user, you can activate EDAS and deploy an application in the EDAS console. Then, the application supports end-to-end tracing analysis, and you do not need to perform additional configurations. For more information, see Get started with EDAS.
  • Method 2: Integrate Application Real-Time Monitoring Service (ARMS) and manually deploy an application

    Integrate ARMS by performing the following operations: Download the relevant JAR package as prompted, configure the corresponding application information, and then add the arms javaagent configuration to the startup script. For more information about the operations, see Manually install an ARMS agent for a Java application.

  • Method 3: Integrate a self-built platform

    If you use a self-built end-to-end tracing analysis platform, you can also integrate it. The following example shows how to integrate SkyWalking:

    1. Download the installation package of a SkyWalking agent and complete the configurations.
    2. Add the following Java virtual machine (JVM) parameter to the Java application startup script: -javaagent:{agent.path}/skywalking-agent.jar.
    3. Switch the SchedulerX Trace plug-in on which the Java application depends to the SkyWalking type. The following code provides an example.
      <dependency>
          <groupId>com.aliyun.schedulerx</groupId>
          <artifactId>schedulerx-plugin-trace-skywalking</artifactId>
          <version>{Latest version}</version>
      </dependency>
Note A default sampling rate is set for data collection in end-to-end tracing analysis. Data is not collected for every execution path. You can specify the sampling rate based on your business scenario.

View tracing analysis results

After you complete the preceding configurations and application deployment, the execution of scheduled jobs is traced from end to end in a visualized manner. Standalone jobs (including HTTP jobs), broadcast jobs, and visual MapReduce jobs are supported.

  1. Log on to the Distributed Task scheduling platform.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Execution List. On the Task instance List tab, perform the following operations as needed in the Operation column.
    • Standalone job

      Click tracing. Alternatively, click Details, and click the ID to the right of TraceId. Then, the Traces page is displayed. Because the application to which the standalone job belongs supports end-to-end tracing analysis (OpenTelemetry), this feature is also applicable to standalone HTTP jobs.

    • Broadcast job

      Click Details. On the Task instance details page, click the Current execution details tab. You can click the ID of a worker in the TraceId column to display the Traces page.

    • Visual MapReduce job

      Click Details. On the Task instance details page, click the Subtask list tab. This tab enables you to query the status of the execution path of every subtask in the execution records in a virtualized manner. In this subtask list of execution record details, you can also click the ID of a subtask in the TraceId column to display the Traces page.