addMeasurement method
Adds measurement to measurements.
If the samplingConfiguration is a PersistentSamplingConfiguration,
also sets its lastTime to now and saves the deployment, at most once
per second.
Implementation
@override
void addMeasurement(Measurement measurement) {
// timestamp this sampling
if (samplingConfiguration is PersistentSamplingConfiguration) {
(samplingConfiguration as PersistentSamplingConfiguration).lastTime = DateTime.now().toUtc();
// Save the checkpoint once per burst, not once per measurement.
_saveCheckpoint ??= Timer(const Duration(seconds: 1), () {
_saveCheckpoint = null;
deployment?.hasBeenUpdated();
});
}
super.addMeasurement(measurement);
}