Repository navigation
Make ActorMetricsSpec processing-time and time-in-mailbox tests robust - #8
Merged
Merged
Conversation
Both metrics are recorded after the actor's receive returns, which can be
after the reply has arrived. The fixture reset could run before the Ping's
metrics were recorded ("2 was not equal to 1"), and the tests could read
before their own message's metrics were recorded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
ActorMetricsSpecfailure seen on #6 (https://github.com/pjfanning/Kamon/actions/runs/38085378060/job/114310667451): "record the processing-time of the receive function" failed with2 was not equal to 1.Cause
ActorMonitorrecords an actor's processing time and time-in-mailbox afterreceivereturns, which can be after the reply has reached the test. This is the same race #5 fixes inRouterMetricsSpec.createTestActor(..., resetState = true)sends aPing, waits for thePongand resets the metrics. ThePing's metrics could be recorded after the reset, so the test counted 2.Changes
Ping's time-in-mailbox (recorded last) before resetting.eventuallywithresetState = false.patienceConfigis 5 s / 5 ms, the same asRouterMetricsSpec. The default 150 ms is tight on CI.kamon-pekko/Test/compileandscalafmtCheckAllpass locally; CI runs the tests.🤖 Generated with Claude Code