Skip to content

Add metrics for messages to and from clients#7851

Open
alexbozhenko wants to merge 3 commits intomainfrom
alex/client_msgs_metrics
Open

Add metrics for messages to and from clients#7851
alexbozhenko wants to merge 3 commits intomainfrom
alex/client_msgs_metrics

Conversation

@alexbozhenko
Copy link
Copy Markdown
Member

@alexbozhenko alexbozhenko commented Feb 19, 2026

Existing In/Out Msgs/Bytes metrics account for traffic from clients, routes, leafnodes and gateways.
So it is hard to see how actual offered load and what is sent to clients changes over time.

Add new metrics that only counts messages from and to clients.

On this Surveyor dashboard screenshot, I was publishing to s1 and subscribing on s3.
Old and new graphs show different picture:
image

And here is an example of values in /varz:

curl -Ss http://localhost:8222/varz http://localhost:8223/varz http://localhost:8224/varz | jq    '{server: .server_name,  in_msgs: .in_msgs, in_bytes: .in_bytes, in_client_msgs: .in_client_msgs,  in_client_bytes: .in_client_bytes, out_msgs: .out_msgs,    out_bytes: .out_bytes, out_client_msgs: .out_client_msgs, out_client_bytes: .out_client_bytes }'
{
  "server": "s1",
  "in_msgs": 10000152,
  "in_bytes": 1280031039,
  "in_client_msgs": 10000000,
  "in_client_bytes": 1280000000,
  "out_msgs": 8451913,
  "out_bytes": 1081861183,
  "out_client_msgs": 0,
  "out_client_bytes": 0
}
{
  "server": "s2",
  "in_msgs": 107,
  "in_bytes": 33648,
  "in_client_msgs": 0,
  "in_client_bytes": 0,
  "out_msgs": 98,
  "out_bytes": 29726,
  "out_client_msgs": 0,
  "out_client_bytes": 0
}
{
  "server": "s3",
  "in_msgs": 8451882,
  "in_bytes": 1081857677,
  "in_client_msgs": 0,
  "in_client_bytes": 0,
  "out_msgs": 8451885,
  "out_bytes": 1081856095,
  "out_client_msgs": 8451755,
  "out_client_bytes": 1081824640
}

Signed-off-by: Alex Bozhenko alexbozhenko@gmail.com

@alexbozhenko alexbozhenko changed the title add metrics for messages from clients Add metrics for messages from clients Feb 19, 2026
@alexbozhenko alexbozhenko force-pushed the alex/client_msgs_metrics branch from bc1a816 to 6079769 Compare February 19, 2026 11:05
@alexbozhenko alexbozhenko marked this pull request as ready for review February 19, 2026 11:38
@alexbozhenko alexbozhenko requested a review from a team as a code owner February 19, 2026 11:38
@MauriceVanVeen
Copy link
Copy Markdown
Member

Should there also be outClientMsgs/Bytes?

@alexbozhenko alexbozhenko marked this pull request as draft February 19, 2026 17:03
@alexbozhenko alexbozhenko changed the title Add metrics for messages from clients Add metrics for messages to and from clients Feb 23, 2026
@alexbozhenko alexbozhenko force-pushed the alex/client_msgs_metrics branch 7 times, most recently from c2cd01e to 331a981 Compare February 24, 2026 09:50
@alexbozhenko alexbozhenko marked this pull request as ready for review February 24, 2026 12:00
@alexbozhenko alexbozhenko force-pushed the alex/client_msgs_metrics branch 2 times, most recently from b829245 to c23674f Compare February 24, 2026 19:59
Copy link
Copy Markdown
Member

@MauriceVanVeen MauriceVanVeen left a comment

Choose a reason for hiding this comment

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

LGTM

@bruth
Copy link
Copy Markdown
Member

bruth commented Mar 2, 2026

I am not opposed to having the standalone client counter, but I had noted before that you can calculate the client sent/recv by subtracting the total from the route, gateway, and leaf metrics that are already present. For reference, this was introduced here: #6967 and a follow-up here #7300.

Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
@alexbozhenko alexbozhenko force-pushed the alex/client_msgs_metrics branch from 5a154f5 to e9954c8 Compare March 16, 2026 10:03
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.

3 participants