Skip to content

Commit

Permalink
fix (blocktimestamp is rounded in seconds)
Browse files Browse the repository at this point in the history
  • Loading branch information
paolocappelletti committed Apr 9, 2024
1 parent 9f2c8ac commit 9d3d56b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions sdk/src/main/java/io/horizen/metrics/MetricsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ private MetricsManager(TimeProvider timeProvider) throws IOException {
blockApplyTime = Gauge.builder().name("block_apply_time").register();
helps.add(new MetricsHelp(blockApplyTime.getPrometheusName(), "Time to apply block to node wallet and state (milliseconds)"));

blockApplyTimeAbsolute = Gauge.builder().name("block_apply_time_fromforging").register();
helps.add(new MetricsHelp(blockApplyTimeAbsolute.getPrometheusName(), "Delta between timestamp when block has been applied succesfully on this node and timestamp of the block indicated by the forger (milliseconds)"));
blockApplyTimeAbsolute = Gauge.builder().name("block_apply_time_fromslotstart").register();
helps.add(new MetricsHelp(blockApplyTimeAbsolute.getPrometheusName(), "Delta between timestamp when block has been applied succesfully on this node and start timestamp of the slot it belongs to (milliseconds)"));

blocksAppliedSuccesfully = Counter.builder().name("block_applied_ok").register();
helps.add(new MetricsHelp(blocksAppliedSuccesfully.getPrometheusName(),"Number of received blocks applied succesfully (absolute value since start of the node)"));
Expand All @@ -66,7 +66,7 @@ private MetricsManager(TimeProvider timeProvider) throws IOException {
helps.add(new MetricsHelp(forgeLotteryTime.getPrometheusName(), "Time to execute the lottery (milliseconds)"));

forgeBlockCreationTime = Gauge.builder().name("forge_blockcreation_time").register();
helps.add(new MetricsHelp(forgeBlockCreationTime.getPrometheusName(), "Time to create a new forged block (milliseconds)"));
helps.add(new MetricsHelp(forgeBlockCreationTime.getPrometheusName(), "Time to create a new forged block (calculated from the start timestamp of the slot it belongs to) (milliseconds)"));
}

public long currentMillis(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ abstract class AbstractSidechainNodeViewHolder[
metricsManager.mempoolSize(newMemPool.size)
metricsManager.appliedBlockOk(
endTime- startTime,
endTime - pmod.timestamp
endTime - (pmod.timestamp * 1000)
);

// TODO FOR MERGE: usedSizeKBytes()/usedPercentage() should be moved into sparkz.core.transaction.MemoryPool
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/scala/io/horizen/forge/AbstractForger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ abstract class AbstractForger[
forgedBlockAsFuture.onComplete{
case Success(ForgeSuccess(block)) => {
log.info(s"Got successfully forged block with id ${block.id}")
metricsManager.forgedBlock(metricsManager.currentMillis() - block.timestamp);
metricsManager.forgedBlock(metricsManager.currentMillis() - (block.timestamp * 1000))
viewHolderRef ! LocallyGeneratedModifier(block)
respondsToOpt.map(respondsTo => respondsTo ! Success(block.id))
}
Expand Down

0 comments on commit 9d3d56b

Please sign in to comment.