A common CDC scenario: an order in MySQL changes from unpaid to paid, SeaTunnel syncs the change downstream, the job is still running, and the application still shows it as unpaid. Separate two questions first: where does a record spend time inside the engine, and has the new value become visible in the target? SeaTunnel's data dyeing module StainTrace can help with the first question; for the second, query the database or follow the read path the application actually uses.
First, be clear about what it is: StainTrace is SeaTunnel's built-in end-to-end performance tracing module. It attaches a traveling marker to sampled records, records stage timestamps at the boundaries of Source, queue, Transform, and Sink, and finally writes a span. It is a sampled latency slice inside the engine, not a full audit log, and not proof that the data has been delivered.
Six Stages, and What They Do Not Cover
In the SeaTunnel 3.1.0 stage reference, only six basic stages are actually instrumented. Subtracting adjacent timestamps gives the time for that section of the pipeline, not the database commit time.
| Stage (code) | Instrumentation point | What the adjacent difference answers |
|---|---|---|
SOURCE_EMIT (1) | Source emits a record | Timing start |
QUEUE_IN (2) | Record enters the queue | From emission to enqueue |
QUEUE_OUT (3) | Record leaves the queue | QUEUE_OUT - QUEUE_IN is time waiting in the queue |
TRANSFORM_IN (4) / TRANSFORM_OUT (5) | Transform receives / outputs a record | The difference is total time for the whole Transform chain |
SINK_WRITE_DONE (6) | After writer.write() returns | The difference from the previous stage is Sink-side time; not commit completion |
Stage order depends on topology: when Transform is fused with Source, it is SOURCE_EMIT → TRANSFORM_IN → TRANSFORM_OUT → QUEUE_IN → QUEUE_OUT → SINK_WRITE_DONE; when fused with Sink, the two Transform events move after QUEUE_OUT. Do not treat one topology's event order as universal.
SINK_COMMIT_END (110), SINK_WRITE_START/END (108/109), network serialization (217–220), and more than forty other stage codes are defined in the enum but have no production instrumentation in 3.1.0 and will not appear in trace files. If a span stops at SINK_WRITE_DONE, all you can say is that the engine observed the write call return; you cannot say the transaction committed, still less that the application can read the value.
Reproduce the Trace Output with Six Rows
I ran Apache SeaTunnel 3.1.0 locally in Zeta mode with JDK 11 and a single worker, running a one-off FakeSource → Console job. There is no database, Transform, or second worker in this test. If you want to try it yourself, just use a separate SeaTunnel installation; FakeSource and Console are connectors bundled with SeaTunnel.
Both switches must be on: the engine-level switch is the master gate, and the job-level switch decides whether this job is sampled. With only one enabled, no file is written.
Add these settings under the existing seatunnel.engine section in config/seatunnel.yaml. Use an empty writable directory for traces. An interval of 1 tries to sample every record in this tiny run; do not copy that setting into a production job.
seatunnel:
engine:
stain-trace-enabled: true
stain-trace-sample-interval: 1
stain-trace-file-base-path: /tmp/seatunnel-article-traces
stain-trace-file-flush-interval-seconds: 1
The canonical name in the configuration reference is stain-trace-sample-rate; stain-trace-sample-interval remains as a backward-compatible alias, and the job-level sample_interval can override the engine level. Each worker produces at most 50 traces per second under a separate budget: even with an interval of 1, a slightly larger job will miss samples because of that budget.
Save this job as stain-trace.conf in the SeaTunnel installation directory.
env {
job.mode = "BATCH"
parallelism = 1
stain_trace {
enabled = true
sample_interval = 1
}
}
source {
FakeSource {
row.num = 6
schema {
fields {
probe = "string"
}
}
}
}
sink {
Console {}
}
Run it from that directory:
bin/seatunnel.sh -DJvmOption='-Xms256m -Xmx768m' -m local -c stain-trace.conf
When the job finishes, inspect the new JSON Lines file under the configured path. It lives at {base}/traces/traces/{job_id}/{yyyy-MM-dd}/traces-*.jsonl; there is another traces directory under the configured path. I counted the stage events inside the span, not the number of log lines the job printed. The local result:
trace files: 1
spans: 6
SOURCE_EMIT: 6
QUEUE_IN: 6
QUEUE_OUT: 6
SINK_WRITE_DONE: 6
SINK_COMMIT_END: 0
The retained per-span record shows that all six spans have the event order SOURCE_EMIT > QUEUE_IN > QUEUE_OUT > SINK_WRITE_DONE, with no Transform events. This rerun retained timestamps: all adjacent-stage differences across the six samples fall between 0 and 2 ms, a scale specific to Console and an in-memory queue that cannot be extrapolated to JDBC writes or production loads.
What Is in a Trace Line, and What Is Not
Each line is an OTLP ExportTraceServiceRequest, with one span per sampled record. The following is a simplified illustration based on the official structure, keeping only the events this job produces; real lines also have outer fields such as resourceSpans and scopeSpans:
{
"traceId": "000000000000000000000000000000c8",
"spanId": "00000000000000c8",
"startTimeUnixNano": "1708000000000000000",
"endTimeUnixNano": "1708000001000000000",
"events": [
{"name": "SOURCE_EMIT", "timeUnixNano": "1708000000000000000"},
{"name": "QUEUE_IN", "timeUnixNano": "1708000000020000000"},
{"name": "QUEUE_OUT", "timeUnixNano": "1708000000080000000"},
{"name": "SINK_WRITE_DONE", "timeUnixNano": "1708000001000000000"}
]
}
traceId/spanIdare zero-padded from internal 64-bit IDs; they have no mapping to business keys, and the span contains no order ID orprobefield. To find "this order", you cannot search traces by order ID.startTimeUnixNano/endTimeUnixNanoare the first and last stage times, andevents[].timeUnixNanoholds each stage time, all as string-formatted nanoseconds. Timestamps are collected at millisecond resolution and the nanosecond tail is usually zero, so do not read it as nanosecond precision.events[].attributesalso carriesseatunnel.stage_codeandseatunnel.task_id. On multi-worker jobs, group by task before discussing stage durations.
Turning Spans into Comparable Numbers
First expand each span into adjacent-stage durations in milliseconds, then aggregate. Replace the path with your own job ID and date:
jq -r '
.resourceSpans[].scopeSpans[].spans[]
| ([.events[] | {stage: .name, ts: (.timeUnixNano | tonumber)}] | sort_by(.ts)) as $e
| range(1; ($e | length)) as $i
| [.traceId, $e[$i-1].stage, $e[$i].stage, (($e[$i].ts - $e[$i-1].ts) / 10000 | round / 100)] | @tsv
' /tmp/seatunnel-article-traces/traces/traces/*/*/traces-*.jsonl
Look at the distribution per stage; this is only meaningful with enough samples:
jq -s -r '
[ .[]
| .resourceSpans[].scopeSpans[].spans[]
| ([.events[] | {stage: .name, ts: (.timeUnixNano | tonumber)}] | sort_by(.ts)) as $e
| range(1; ($e | length)) as $i
| {seg: ($e[$i-1].stage + " -> " + $e[$i].stage), ms: (($e[$i].ts - $e[$i-1].ts) / 10000 | round / 100)}
]
| group_by(.seg)[]
| (map(.ms) | sort) as $xs
| "\(.[0].seg)\tn=\($xs | length)\tp50=\($xs[((($xs | length) * 0.50) | floor)])\tp95=\($xs[((($xs | length) * 0.95) | floor)])"
' /tmp/seatunnel-article-traces/traces/traces/*/*/traces-*.jsonl
Six samples are enough to see stage order but not to compute P95. If QUEUE_IN → QUEUE_OUT is consistently the longest segment across samples from the same worker, check queue depth, backpressure, and whether downstream operators keep up; if time concentrates in QUEUE_OUT → SINK_WRITE_DONE, inspect connector buffering and target-database waits before blaming storage. That difference still includes Sink-side formatting, batch aggregation, and I/O, and those fine-grained stages are not instrumented in 3.1.0, so it cannot be split further.
If you would rather not write jq, use the official analysis tool: put analyze-traces.sh and seatunnel-trace-analyzer-*-jar-with-dependencies.jar together and run ./analyze-traces.sh /tmp/seatunnel-article-traces report.html to get an HTML report. The figure below shows one of the trace views.

Four Things Most Easily Misjudged in Production Triage
No trace does not mean no data. Sampling takes the record sequence modulo the rate at the Source (seq % rate == 0, see the implementation note), not by business key; each worker also has a 50-traces-per-second budget. If a business key is absent from traces, it either was not sampled or did not pass the budget, so you cannot conclude the row was lost.
A 1-to-N Transform traces only the first output by default. When one record expands into several, only the first inherits the payload; filtered-out branches have no later stages at all. To cover every branch, set stain-trace-propagate-to-all-splits: true. Before asking "where did a row go", check whether the topology contains such an expansion.
Defined does not mean instrumented. SINK_COMMIT_END is in the stage-code table but never appears in a trace; the same goes for SOURCE_READ_END, network serialization, and flow-control audits. Writing "no such event" as "this step took no time" is wrong.
Overhead and files depend on the sampling rate. The official figures are below 2% at 1/100000, below 5% at 1/1000, and below 10% at 1/100; use a low rate and a short window in production, then raise it temporarily during triage. Keep the trace path under the same storage root as checkpoint state so the two do not end up with different permissions; flush defaults to 10 seconds, so a short job may leave an empty file, which is safe to delete. If no file appears, check both switches and directory permissions first.
From Order ID to Conclusion
| Symptom | Next evidence to collect | Layer |
|---|---|---|
| The target primary has the expected new value by business key, but the application still shows the old one | The endpoint, replica, isolation level, and cache the application actually reads; see article 03 in this series | Read path |
The primary has no value, and the trace has SINK_WRITE_DONE with the task mapped to the correct Sink | Connector buffering, target transaction, and wait events | Target |
Samples consistently stop between QUEUE_IN and QUEUE_OUT | Queue depth, backpressure, downstream consumption | Engine |
| No trace for this business key | Sampling rate, budget, and whether a 1-to-N expansion was hit; then confirm with source offsets or a probe whether the record entered the job | Undetermined |
Across workers or nodes, network serialization stages are not instrumented, so a blank stretch in a span is not network time. Production triage must also separate failed and replayed execution attempts; this Console test covers neither.
Keep two pieces of evidence separate in the incident record: the writer call returned is engine-side evidence; the application read the paid order is a separate observation. Neither implies the other, and the latter cannot tell you when the former happened.
Three Sentences You Can Take Away
- StainTrace is sampled, stage-sliced in-engine latency evidence, not an end-to-end consistency proof.
- Stage differences can only locate which segment the time falls in; commit and visibility need separate evidence from the target database and the read path.
- Low sampling in production, high sampling in short triage windows; no trace does not mean no data, and no COMMIT event does not mean no commit.















Figure 1 SeaTunnel Workflow
Figure 2 Data Synchronization Log Information










picture
The left-hand side briefly lists the Source scenarios, for example, we abstract the Source’s API, Type, and State, to read the data source, unifying the data types of the various data sources to the abstract type defined in it, and some state recovery and retention of the read location during the reading process.
From the diagram above we see the different data sources, Source is responsible for reading data from the various data sources and transforming it into SeaTunnelRow abstraction layer and Type to form the abstraction layer, Sink is responsible for pulling data from the abstraction layer and writing it to the concrete data store to transform it into the store concrete format.
We can specify the number of Sources, Sink configuration file combinations through the configuration file The commands in the toolkit provided by SeaTunnel take the configuration file with them and when executed enable data handling.
This is the Connector ecosystem that is currently supported by SeaTunnel, such as the data sources supported by JBDC, HDFS, Hive, Pulsar, message queues, etc. are currently supported.
Firstly, there are the typical usage scenarios supported by Source, such as bulk reading of devices, field projection, data type mapping, parallel reading, etc.
The BOOLEAN, INT32, INT64, etc. listed here all have corresponding SeaTunnel data types. INT32 can be mapped according to the read type on the SeaTunnel, or to TINYINT, SMALLINT, or INT when the range of values is small.
This is the corresponding example code showing how the mapping is done where the type conversion is done.
The SQL extraction of column codes allows you to extract only some of the columns you need, and when used on SeaTunnel, you can specify the name, type, etc. of the column after it is mapped to SeaTunnel via fields. The final result of the data read on SeaTunnel is shown in the figure above.

Assuming there is a table in IoTDB, we project the device column onto SeaTunnel by making it data as well through syntax. After configuring the device name column and specifying the data type, we end up reading the data on SeaTunnel in the format shown above, containing the Time, device column, and the actual data value. This makes it possible to read data from the same device in bulk.








Another typical usage scenario is to import data from other data sources into IoTDB. suppose I have an external database table with columns like ts, temperature, humidity, etc. and we import it into IoTDB, requiring the columns of temperature and humidity, but the rest can be left out. The whole configuration is shown in the diagram above, you can refer to it.
Apache SeaTunnel Committer | Zongwen Li
When SeaTunnel entered the Apache incubator, the SeaTunnel community ushered in rapid growth.
For distributed streaming processing systems, high throughput and low latency are often the most important requirements. At the same time, fault tolerance is also very important in distributed systems. For scenarios that require high correctness, the implementation of exactly once is often very important.
The previous problem will cause a long-time recovery, and the business service may accept a certain degree of data delay.
The previous examples are cases regarding a small number of tables, but in real business service development, we usually need to synchronize thousands of tables, which may be divided into databases and tables at the same time;
Besides, according to the research report of Fivetran, 60% of the company’s schema will change every month, and 30% will change every week.
If our Source or Sink is of JDBC type, since the existing engine only supports one or more links per table, when there are many tables to be synchronized, more link resources will be occupied, which will bring a great burden to the database server.
In the existing engine, a buffer and other control operators are used to control the pressure, that is, the back pressure mechanism; since the back pressure is transmitted level by level, there will be pressure delay, and at the same time, the processing of data will not be smooth enough, increasing the GC time, fault-tolerant completion time, etc.
In the data integration case, there is a possibility that a job can synchronize hundreds of sheets, and the failure of one node or one table will lead to the failure of all tables, which is too costly.
For example, if the Source fails, the Sink does not need to restart. In the case of a single Source and multiple Sinks, if a single Sink fails, only the Sink and Source that failed will be restored; that is, only the node that failed and its upstream nodes will be restored.
For sink failure, when data cannot be written, a possible solution is to work two jobs at the same time.
Schema Evolution is a feature that allows users to easily change the current schema of a table to accommodate changing data over time. Most commonly, it is used when performing an append or overwrite operation, to automatically adjust the schema to include one or more new columns.
The Multi-table feature can reduce the use of some Source and Sink link resources. At the same time, we have implemented Dynamic Thread Resource Sharing in SeaTunnel Engine, reducing the resource usage of the engine on the server.
As for the problems that cannot be solved by the back pressure mechanism, we will optimize the Buffer and Checkpoint mechanism:
Bo Bi, data engineer at Mafengwo
This shows that the core of SeaTunnel is the Source, Transform and Sink process definitions.
The above diagram shows the definition of the interface, the Plugin interface in SeaTunnel abstracts the various actions of data processing into a Plugin.
Execution, the data flow builder used to build the entire data flow based on the first three, is also part of the base API


SeaTunnel’s API consists of three main parts.
Then find the Connector path from the Connector plugin directory and stitch it into the Spark-submit launch command with — jar, so that the found Plugin jar package can be passed to the Spark cluster as a dependency.
The core Source API interaction flow is shown above. In the case of concurrent reads, the enumerator SourceSplitEnumerator is required to split the task and send the SourceSplit down to the SourceReader, which receives the split and uses it to read the external data source.
The overall Sink API interaction flow is shown in the diagram below. The SeaTunnel sink is currently designed to support distributed transactions, based on a two-stage transaction commit.
For the Kafka sink connector implementation, the first stage is to do a pre-commit by calling KafkaProducerSender.prepareCommit().
SeaTunnel V2: Thanks to the work of the engine translator, the Connector API, and the SeaTunnelRow, the data source of the SeaTunnel internal data structures accessed through the Connector, are translated by the translation layer into a runnable Spark API and spark dataset that is recognized inside the engine during data transformation.
Hornet’s Nest Big Data Development Platform, which focuses on providing one-stop big data development and scheduling services, helps businesses solve complex problems such as data development management, task scheduling and task monitoring in offline scenarios.
The Hornet’s Nest Big Data Development and Scheduling Platform consists of four main modules: the task component layer, the scheduling layer, the service layer, and the monitoring layer.
To address the pain points mentioned above, we actively explored solutions and conducted a selection analysis of several mainstream data integration products in the industry. As you can see from the comparison above, Datax and SeaTunnel both offer good scalability, and high stability, support rich connector plugins, provide scripted, uniformly configurable usage, and have active communities.
StarRocks currently also supports Spark Load, based on the Spark bulk data import method, but our ETL is more complex, needs to support data conversion multi-table Join, data aggregation operations, etc., so temporarily can not meet.
We’ll divide it into four key parts:








In fact, the implementations of Connectors like Feishu, DingTalk, and Facebook messenger are quite simple as the connectors do not need to carry a large amount of data (just a simple Source and Sink). This is in sharp contrast to Hive and other databases that need to consider transaction consistency or concurrency issues.

















































Spark logs are generated during the running process, and both successful running and running errors can be viewed in the logs.










