v1.4 fix timestamp metrics (#14235)

* Fix genesis timestamp metric source

* Move timestamp metrics to report even on estimate failure
This commit is contained in:
Tyera Eulberg
2020-12-21 15:02:32 -07:00
committed by GitHub
parent 9466ad3c1f
commit 4e7049bdf2

View File

@ -1301,12 +1301,13 @@ impl Bank {
} else { } else {
(EstimateType::Unbounded, None) (EstimateType::Unbounded, None)
}; };
let ancestor_timestamp = self.clock().unix_timestamp;
if let Some(timestamp_estimate) = if let Some(timestamp_estimate) =
self.get_timestamp_estimate(estimate_type, epoch_start_timestamp) self.get_timestamp_estimate(estimate_type, epoch_start_timestamp)
{ {
if timestamp_estimate > unix_timestamp { if timestamp_estimate > unix_timestamp {
unix_timestamp = timestamp_estimate; unix_timestamp = timestamp_estimate;
let ancestor_timestamp = self.clock().unix_timestamp;
if self if self
.feature_set .feature_set
.is_active(&feature_set::timestamp_bounding::id()) .is_active(&feature_set::timestamp_bounding::id())
@ -1314,16 +1315,16 @@ impl Bank {
{ {
unix_timestamp = ancestor_timestamp; unix_timestamp = ancestor_timestamp;
} }
}
}
datapoint_info!( datapoint_info!(
"bank-timestamp-correction", "bank-timestamp-correction",
("slot", self.slot(), i64), ("slot", self.slot(), i64),
("from_genesis", unix_timestamp, i64), ("from_genesis", self.unix_timestamp_from_genesis(), i64),
("corrected", timestamp_estimate, i64), ("corrected", unix_timestamp, i64),
("ancestor_timestamp", ancestor_timestamp, i64), ("ancestor_timestamp", ancestor_timestamp, i64),
); );
} }
}
}
let epoch_start_timestamp = if self let epoch_start_timestamp = if self
.feature_set .feature_set
.is_active(&feature_set::timestamp_bounding::id()) .is_active(&feature_set::timestamp_bounding::id())