Flink is a stateful stream processor. It stores managed state in its state backend (most apps use the embedded rocksdb state backend), which is made durable via checkpoints and savepoints. The docs are here:
https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/dev/datastream/fault-tolerance/state/
If you use SQL or the Table API to join your incoming metrics with this context info, Flink will use this managed state for you. If you use the DataStream API, you'll need to explicitly handle the state yourself.