In distributed microservices, end-to-end tracing offers a visual method to quickly analyze execution flows and pinpoint issues across services. Because scheduled tasks often have longer call chains than real-time services, tracing is essential for querying execution times and analyzing errors. This topic explains how to integrate end-to-end tracing with your scheduled tasks.
Prerequisites
-
The client version is 1.7.0 or later.
-
The client depends on the Trace plugin. For more information, see Integration configuration.
-
Upgrade the application to the Professional Edition. For more information, see How to upgrade to the Professional Edition.
Integrate link tracing
Configuration
For a Spring Boot application, add the following dependencies to your pom.xml file.
<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 dependency for the trace extension plugin. -->
<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>-->
Application deployment
-
Option 1: Deploy your application on EDAS (Recommended)
-
If you already use EDAS to deploy your application, the tracing capability is already enabled. You can skip this section.
-
New users can activate EDAS, which automatically integrates end-to-end tracing for all deployed applications without requiring extra configuration. For more information, see Get Started with EDAS.
-
-
Option 2: Integrate with ARMS for standalone deployment
Refer to the ARMS application integration process. Download the required JAR packages and configure the corresponding application information as prompted. Add the arms javaagent configuration to the startup script to complete the integration. For detailed instructions, see Manually install the agent.
-
Option 3: Integrate with a self-hosted platform
If you use a self-hosted end-to-end tracing platform, you can still integrate it. The following steps show an example with skywalking.
-
Download and configure the skywalking agent package.
-
Add the following JVM argument to your Java application's startup script:
-javaagent:{agent.path}/skywalking-agent.jar. -
In your Java application, switch the SchedulerX Trace plugin dependency to the one for skywalking, as shown in the following example.
<dependency> <groupId>com.aliyun.schedulerx</groupId> <artifactId>schedulerx-plugin-trace-skywalking</artifactId> <version>{latest_version}</version> </dependency>
-
End-to-end tracing uses a default sampling rate, which means not every call chain is captured. You can adjust this rate to meet your business needs.
View link traces
After you configure and deploy your application, you can visualize end-to-end traces for your scheduled tasks. This feature is supported for standalone tasks (including HTTP tasks), broadcast tasks, and visualized Map tasks.
Log on to the MSE SchedulerX console.
-
In the top navigation bar, select a region.
-
In the left-side navigation pane, click Execution List and select the Task instance List tab. In the Actions column, the required action depends on the task type:
-
Standalone tasks
Either click tracing, or click Details and then click the TraceId, to view its call chain. This feature also applies to standalone HTTP tasks because the host application is deployed with end-to-end tracing enabled (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 corresponding call chain.
-
Visualized Map tasks
Click Details. On the Task instance details page, click the Subtask list tab. For visualized Map tasks, each subtask has an execution trace. In the subtask list, click the TraceId for a subtask to view its call chain.
-