Skip to content

Enhance open connection metrics#8124

Merged
lijunwangs merged 2 commits intoanza-xyz:masterfrom
lijunwangs:enhance_open_connection_metrics
Sep 22, 2025
Merged

Enhance open connection metrics#8124
lijunwangs merged 2 commits intoanza-xyz:masterfrom
lijunwangs:enhance_open_connection_metrics

Conversation

@lijunwangs
Copy link
Copy Markdown

Problem

We only have open_connections which include both staked and unstaked. It is hard to tell what is the usage for each.

Summary of Changes

introduced open_staked_connections and open_unstaked_connections metrics.

Fixes #

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.9%. Comparing base (4fc75e0) to head (79d1ba7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8124   +/-   ##
=======================================
  Coverage    82.9%    82.9%           
=======================================
  Files         823      823           
  Lines      361216   361241   +25     
=======================================
+ Hits       299777   299809   +32     
+ Misses      61439    61432    -7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lijunwangs lijunwangs marked this pull request as ready for review September 22, 2025 08:08
struct ConnectionTable {
table: IndexMap<ConnectionTableKey, Vec<ConnectionEntry>>,
total_size: usize,
is_staked: bool,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For the readability, I personally would prefer enum with Staked/Unstaked. More like an opinion, not really insisting on it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will do in a follow up PR

Copy link
Copy Markdown

@KirillLykov KirillLykov left a comment

Choose a reason for hiding this comment

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

looks good to me to distinguish these two metrics.

Comment thread streamer/src/quic.rs
@@ -210,6 +210,8 @@ pub struct StreamerStats {
pub(crate) connection_rate_limiter_length: AtomicUsize,
// All connections in various states such as Incoming, Connecting, Connection
pub(crate) open_connections: AtomicUsize,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we axe open_connections ? it gets updated differently and can be very confusing. If someone ever needs the sum, they can trivially add the two in SQL in metrics.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will do in a follow up PR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@alexpyattaev, I reviewed the code again. I think there is a value of having open_connections which can track all open connections in various state -- even the connections which did not make into the connection table yet like those spawn into the async tasks before they were allowed into the connection table. This can help understand the worst case connection load in the system.

Copy link
Copy Markdown

@alexpyattaev alexpyattaev left a comment

Choose a reason for hiding this comment

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

The idea is great, thank you! However, I believe we should axe open_connections stat completely from code, it is extra complexity for no benefit. Can be another PR of course.

@lijunwangs lijunwangs merged commit 54205f5 into anza-xyz:master Sep 22, 2025
43 checks passed
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