Repository navigation
Conversation
…rted observe reset only quic-v1 and tcp before each sample. A WebSocket, WebTransport or WebRTC connection that closed left its stream count on the gauge for good, since nothing wrote that label again. Remember every transport the gauge has a value for and set it back to 0 when none of its connections is left.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a fix to ensure that stream pressure metrics for transports other than QUIC and TCP correctly fall back to 0 when their last connection is closed. It adds a reported map to track previously reported transports, resets their busiest counts to 0 at the start of an observation, and updates the mutex locking to protect this new state. A corresponding unit test, TestStreamPressureClearsATransportWithNoConnectionLeft, has been added to verify this behavior. I have no feedback to provide as the changes are well-implemented and include appropriate test coverage.
This branch has not been deployed
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.
StreamPressure.observereset onlyquic-v1andtcpbefore each sample. The router listens on WebSocket, WebTransport and WebRTC as well, and the node uses libp2p's default transports, so when the last connection of one of those closed its stream count stayed on the busiest-stream gauge for good, since nothing wrote that label again.The sampler now remembers every transport the gauge has a value for and sets it back to 0 when none of its connections is left.
TestStreamPressureClearsATransportWithNoConnectionLeftfailed on the previous code (busiest websocket after its last connection closed = 7, want 0).go test -race ./internal/p2plimits/ ./internal/router/ ./internal/node/andgo vetpass on Linux.