Skip to content

Conversation

ARR4N
Copy link
Contributor

@ARR4N ARR4N commented Jan 28, 2025

Why this should be merged

Allows for alerting should proposervm block times drift too far from their inner blocks.

How this works

Adds a new proposervm vector metric for last-accepted timestamp.

Lightly held opinion: although this introduces a redundant metric (proposervm_last_accepted_timestamp with block_type=proposervm is identical to snowman_last_accepted_timestamp), I don't think we should remove the latter because it has a natural partner in snowman_last_accepted_height. Also, while usage of proposervm is currently required, if this were to change then there would be a need for the snowman metric but it would likely be forgotten. In summary, I think a little redundancy is ok in return for snowman-metric completeness.

How this was tested

Unit test.

Need to be documented in RELEASES.md?

Nope.

@ARR4N ARR4N marked this pull request as ready for review January 29, 2025 10:05
ARR4N and others added 2 commits January 29, 2025 12:51
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Copy link
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Just tiny minor comments

Comment on lines +2539 to +2541
defer func() {
require.NoError(t, proVM.Shutdown(ctx))
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer func() {
require.NoError(t, proVM.Shutdown(ctx))
}()
t.Cleanup(func() {
require.NoError(t, proVM.Shutdown(ctx))
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to @StephenButtolph on this due to consistency within the file.

Is there any real difference between the two? If anything I think it would be better to call t.Cleanup() inside initTestProposerVM() and remove it from everywhere else, but not in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We switched to using t.Cleanup in some of our other packages (in holistic passes). Seems like something that could be pulled out into a followup

{innerBlockTypeMetricLabel, innerTime},
{outerBlockTypeMetricLabel, outerTime},
}
for _, tt := range tests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit why tt and not test 👀 I suppose not to conflict with t? 🤔 But test is nice and short too 😅 Just a general comment for future code, please no need to change it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah tt to not shadow t. It was common enough in the Google code base (along with tc for test case) that it was generally known exactly what it was (like ctx) so I picked it up as a habit, but appreciate that that may not be the case outside. I tend to keep using it over test because of the number of times it gets used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably slightly prefer test as well - but I don't really care tbh

ARR4N and others added 2 commits January 29, 2025 14:14
Co-authored-by: Quentin McGaw <quentin.mcgaw@avalabs.org>
Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Copy link
Contributor

@StephenButtolph StephenButtolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# HELP avalanche_proposervm_last_accepted_timestamp timestamp of the last block accepted
# TYPE avalanche_proposervm_last_accepted_timestamp gauge
avalanche_proposervm_last_accepted_timestamp{block_type="inner",chain="C"} 1.738141385e+09
avalanche_proposervm_last_accepted_timestamp{block_type="inner",chain="P"} 1.738164828e+09
avalanche_proposervm_last_accepted_timestamp{block_type="inner",chain="X"} 1.738153495e+09
avalanche_proposervm_last_accepted_timestamp{block_type="proposervm",chain="C"} 1.738141385e+09
avalanche_proposervm_last_accepted_timestamp{block_type="proposervm",chain="P"} 1.738164828e+09
avalanche_proposervm_last_accepted_timestamp{block_type="proposervm",chain="X"} 1.738153495e+09

@StephenButtolph StephenButtolph added this pull request to the merge queue Jan 29, 2025
Merged via the queue into master with commit d8f649a Jan 29, 2025
22 checks passed
@StephenButtolph StephenButtolph deleted the arr4n/proposervm_timestamp_metrics branch January 29, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants