Event time
the time an event occurred
What it is
Event time is the time at which a recorded event occurred according to the source responsible for it. For a temperature reading, it might be the instant a sensor measured the temperature. A collector may receive it later, and a stream processor might handle it after another wait. Those are separate times. A question about what happened during a particular hour needs the appropriate timestamp from the event.
A system also observes processing time, which is the time at the processor while it works. Processing time can be useful for measuring when a job ran or how long data waited in the pipeline. Event time preserves the relationship between records and what they describe. An event can arrive after a later event because of offline operation, a retry, or a source that sends readings in batches.
Stream processors can use watermarks to track how far they believe event time has advanced. A watermark is a signal about expected progress, used to decide when operations such as an hourly window can publish a result. Records can still arrive after a window is first reported. The treatment of late data depends on the application’s policy. It may update the result, collect late records for another process, or use an agreed deadline before issuing a final figure.
Why it matters
Imagine a network of monitors reporting outages. One monitor loses its connection at the same time as the service it observes. It later delivers several records together. A report grouped by when its server processed the records would show those events late. A report grouped by when observations happened can associate them with the original outage and compare them with information from other monitors. The two reports answer different questions and both can be useful.
Late data puts a price on early answers. An operations dashboard may benefit from an initial estimate that gets corrected a minute later. A statement that a customer will use to settle a bill needs a clearly defined point at which it becomes final, along with a way to handle corrections after that point. Choose a deadline with users and make it visible. A system that quietly changes old figures can make otherwise correct calculations hard to trust.
Timestamp quality matters as much as the choice of clock. A device can be misconfigured or change timezones while offline. An event producer can confuse the units of a timestamp or forget to record how it was derived. Give the source timestamp a defined meaning and preserve provenance needed to inspect it. Track receive time separately so that unusually late records and implausible future times can be investigated.
What it looks like in practice
Consider a stream of geographic survey measurements taken at remote locations. An illustrative event includes its measurement time, the time a collector received it and an identifier that stays stable on resend. The reporting task groups records by their measurement hour and region. While connectivity is normal, several windows can be open at once. A watermark advances as inputs provide evidence about the latest expected times. Once the reporting threshold passes, the job can emit a partial or complete result according to the agreed policy.
Test a normal hour, a device that sends the previous hour after reconnecting, and a period when one input goes quiet. With some stream-processing setups a combined watermark depends on the slowest active input. An idle source can therefore delay windows even though other inputs continue. Give the job a policy for identifying idle partitions and bring the delayed records back in a controlled test. Measure how long it takes readers to see a value and how they recognise a correction.
Engineer’s GIS pipeline automation case study describes making schedules, logs and failure handling consistent across real delivery jobs. It provides a useful context for the timing decisions in this example. A pipeline can run on schedule and still publish late or incomplete source observations. Track the age of the data and the state of the delivery separately so users know what the result represents.
Where it goes wrong
A job may use the convenient receive timestamp because every record already has one. During a replay, the same historical data can then be assigned to a later hour. Make the timestamp assigned to the occurrence explicit in the record definition and test it through a replay. A corrected occurrence time needs an intentional policy as well, because it can move a record from one report to another.
A reporting calendar may use local civil time, while the data stores each event as an unambiguous instant. Around a daylight-saving change, an hour can disappear or occur twice in that local calendar. Include the reporting timezone and the offset where the displayed label would otherwise be ambiguous. A fixture that crosses a clock change can reveal an unnoticed assumption about the number of periods per day.
Another common problem is a mismatch between how a processor updates results and how a downstream reader stores them. A corrected hourly total might be emitted as a replacement. A consumer that appends both output records and sums all rows can count the same hour twice. Choose a stable key for the hour and region and document whether the output represents a replacement, a change or a new historical edition. Test a late record all the way through the final report.
Keep the measurement of delay visible. Count records that arrive after the initial deadline and after the final correction window. Check event times ahead of the expected clock and inputs that stop reporting. A faster initial result can be valuable. Its meaning stays clearer when readers can see whether it is provisional, when it may be revised, and which sources contributed.
Further reading
- Apache Flink streaming analytics and event time. Introduces time-based stream calculations and watermarks.
- Apache Flink guidance for debugging event time. Describes ways to investigate stuck windows and delayed progress.
- Google’s Dataflow model paper. Examines latency, completeness and revisions in out-of-order processing.