From 623f3e240da5a1004b4b3fc025b17d9268482eb8 Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Mon, 9 Dec 2024 14:28:40 +0000 Subject: [PATCH] fix: sequencer negative histogram recodings (#10490) Fix for these two otel warnings ``` negative value provided to histogram aztec.sequencer.state_transition_buffer.duration: INT value type cannot accept a floating-point value for aztec.sequencer.state_transition_buffer.duration, ignoring the fractional digits. ``` --- yarn-project/sequencer-client/src/sequencer/sequencer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yarn-project/sequencer-client/src/sequencer/sequencer.ts b/yarn-project/sequencer-client/src/sequencer/sequencer.ts index d1bd7d3df1d..89d4fe2c313 100644 --- a/yarn-project/sequencer-client/src/sequencer/sequencer.ts +++ b/yarn-project/sequencer-client/src/sequencer/sequencer.ts @@ -385,7 +385,6 @@ export class Sequencer { } const bufferSeconds = this.timeTable[proposedState] - secondsIntoSlot; - this.metrics.recordStateTransitionBufferMs(bufferSeconds * 1000, proposedState); if (bufferSeconds < 0) { this.log.warn( @@ -393,6 +392,9 @@ export class Sequencer { ); return false; } + + this.metrics.recordStateTransitionBufferMs(Math.floor(bufferSeconds * 1000), proposedState); + this.log.debug( `Enough time to transition to ${proposedState}, max allowed: ${this.timeTable[proposedState]}s, time into slot: ${secondsIntoSlot}s`, );