x:Metric: say which node wrote each sample
Each node stores histograms as running totals since it started. A sample didn't say which node wrote it (the node was only in the id's low bits), so a reader couldn't diff totals per node, and the console diffed across nodes: on the three-node production cluster the delivery attempt time read 14.7 s over the last hour against 0.7 s from the nodes' own figures. x:Metric/get now returns nodeId alongside timestamp, both from the id. The telemetry suite checks every sample carries it.
This commit is contained in:
@@ -108,6 +108,12 @@ impl SnowflakeIdGenerator {
|
||||
(id >> (SEQUENCE_LEN + NODE_ID_LEN)) / 1000 + DEFAULT_EPOCH
|
||||
}
|
||||
|
||||
// inbuxa: the node that made the id, so per-node history (metric
|
||||
// totals) can be told apart
|
||||
pub fn to_node_id(id: u64) -> u64 {
|
||||
id & NODE_ID_MASK
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn past_id(&self, period: Duration) -> Option<u64> {
|
||||
self.epoch.elapsed().ok().map(|elapsed| {
|
||||
|
||||
Reference in New Issue
Block a user