Scheduled jobs in distributed microservices often have longer execution paths than real-time services. Tracing analysis captures the full execution path of each job run, so you can measure step durations, pinpoint failures, and visualize the end-to-end flow in the SchedulerX console.
Prerequisites
Before you begin, make sure that you have:
An agent running version 1.7.0 or later
The Trace plug-in dependency added to your agent (see Add tracing dependencies)
An application upgraded to Professional Edition
Add tracing dependencies
Add the following dependencies to the pom.xml file of your Spring Boot application.
SchedulerX starter with logging exclusions:
<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>Trace plug-in -- choose one:
| Tracing backend | Artifact ID | When to use |
|---|---|---|
| OpenTelemetry (default) | schedulerx-plugin-trace-opentelemetry | Use with EDAS or ARMS |
| SkyWalking | schedulerx-plugin-trace-skywalking | Use with a self-built SkyWalking platform |
OpenTelemetry plug-in:
<dependency>
<groupId>com.aliyun.schedulerx</groupId>
<artifactId>schedulerx-plugin-trace-opentelemetry</artifactId>
<version>{Latest version}</version>
</dependency>SkyWalking plug-in:
<dependency>
<groupId>com.aliyun.schedulerx</groupId>
<artifactId>schedulerx-plugin-trace-skywalking</artifactId>
<version>{Latest version}</version>
</dependency>Deploy your application
Connect your application to a tracing backend using one of the following methods.
Deploy in EDAS (recommended)
Enterprise Distributed Application Service (EDAS) has built-in tracing support. If your application already runs in EDAS, tracing analysis works with no extra configuration.
To get started with EDAS, activate the service and deploy your application from the EDAS console. For detailed steps, see Get started with EDAS.
Integrate Application Real-Time Monitoring Service (ARMS)
Download the ARMS agent JAR package.
Configure your application information.
Add the arms javaagent parameter to your startup script.
For detailed steps, see Manually install an ARMS agent.
Integrate a self-built tracing platform
If you run a self-built tracing platform such as SkyWalking:
Download and configure the SkyWalking agent package.
Add the following JVM parameter to your Java application startup script:
-javaagent:{agent.path}/skywalking-agent.jarSwitch the SchedulerX trace plug-in dependency to the SkyWalking artifact:
<dependency> <groupId>com.aliyun.schedulerx</groupId> <artifactId>schedulerx-plugin-trace-skywalking</artifactId> <version>{Latest version}</version> </dependency>
View tracing analysis results
After you complete the integration and deployment, SchedulerX traces job executions end to end. The following job types are supported:
| Job type | Tracing scope |
|---|---|
| Standalone jobs (including HTTP jobs) | Full end-to-end trace |
| Broadcast jobs | Per-worker traces |
| Visual MapReduce jobs | Per-subtask traces |
A default sampling rate applies to trace data collection. Not every execution is captured. Adjust the sampling rate based on your requirements.
To view traces:
Log on to the Distributed Task scheduling platform.
Log on to the EDAS console.
In the left-side navigation pane, click Task Scheduling (SchedulerX).
In the top navigation bar, select a region.
In the left-side navigation pane, click Execution List.
On the Task instance List tab, locate the job instance and use the Operation column to view traces.
Standalone jobs
Click tracing in the Operation column. Alternatively, click Details, then click the ID next to TraceId to open the Traces page.
Because the application to which the standalone job belongs supports end-to-end tracing analysis, this method also applies to standalone HTTP jobs.
Broadcast jobs
Click Details in the Operation column.
On the Task instance details page, click the Current execution details tab.
Click a worker ID in the TraceId column to open the Traces page.
Visual MapReduce jobs
Click Details in the Operation column.
On the Task instance details page, click the Subtask list tab.
Review subtask execution status in the list. Click a subtask ID in the TraceId column to open the Traces page.