Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance counters (metrics) #1027

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

bollhals
Copy link
Contributor

Proposed Changes

This change introduces performance counters for the client.
For now available are:

  • total-connection-opened
  • open-connection-count
  • total-channel-opened
  • open-channel-count
  • bytes-sent-rate
  • bytes-received-rate
  • AMQP-method-sent-rate
  • AMQP-method-received-rate

fixes the counter part of #776

I've also fixed in the first commit a bug that happens if the first read into the header buffer returned not the full 7 bytes. (happend a lot when I ran the MassPublish test app with 50 mio messages.)

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

@bollhals
Copy link
Contributor Author

bollhals commented Mar 12, 2021

Do we want other counters or are we fine with the current ones for now?

Example output for dotnet-counters
image

[EventSource(Name="rabbitmq-dotnet-client")]
public sealed class RabbitMqClientEventSource : EventSource
#nullable enable
internal sealed partial class RabbitMqClientEventSource : EventSource
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 changed it to internal, as others shouldn't be able to do anything with these methods here

@michaelklishin
Copy link
Member

Should the totals be named in plural, e.g.

  • Total connections opened
  • Total channels opened
  • Currently open connection count
  • Currently open channel count

We can also use the terms from the Prometheus/OpenTelemetry communities, e.g. gauge and counter for suffixes.

@bollhals
Copy link
Contributor Author

Should the totals be named in plural, e.g.

  • Total connections opened
  • Total channels opened
  • Currently open connection count
  • Currently open channel count

We can also use the terms from the Prometheus/OpenTelemetry communities, e.g. gauge and counter for suffixes.

Happy to adapt to whatever we agree upon 👍
We should probably also consider what already exist in the dotnet sources

@michaelklishin
Copy link
Member

Looking at those search results I'd say the names should be

  • Total connections opened
  • Total channels opened
  • Current connection counter
  • Current channel counter

This would very much follow the names in KestrelEventSource.cs, for example, but "opened" would be slightly clearer. We can also add a "closed" counterpart so it would be easy to see if there are any connection or channel leaks. "Current" counters do not necessarily make it obvious.

@bollhals
Copy link
Contributor Author

I used to have the closed counterpart, but the thing is you always want to know how many are still open, so you have to compare agsinst the open counter. => just have an open/current counter.
I assume the names eould be the same but the spaces replaced with dashes? (Need both name & displayname)

@stebet
Copy link
Contributor

stebet commented Mar 13, 2021

This is awesome!

I'd love to see frames sent/received if that's not too hard to add as well.

@michaelklishin
Copy link
Member

Yes, names can be underscored or dashed as conventional in this particular community.

@bollhals
Copy link
Contributor Author

This is awesome!

I'd love to see frames sent/received if that's not too hard to add as well.

Frames received is easy, sent not really as we combine the three frames of a basic deliver method into one byte blob to send. (See the bytes/command sent, they're done in the same place)
OR we'd have to count them before we actually sent them, but this is kind of lying as it wasn't sent yet at that time.

And only having the frames received is also strange, that's why I havet't added them in this first draft.

Do you have an idea on how we could solve this best?

@bollhals bollhals force-pushed the feature/perf.counters branch 2 times, most recently from 0da3288 to 04b007b Compare March 15, 2021 21:44
@bollhals
Copy link
Contributor Author

Updated the names to

  • total-connections-opened
  • current-open-connections
  • total-channels-opened
  • current-open-channels

Also updated the event source name to rabbitmq-client

@michaelklishin michaelklishin changed the title Performance counters for rabbitmq Performance counters (metrics) Mar 16, 2021
@michaelklishin
Copy link
Member

@bollhals can you please rebase this on top of master? Then we can merge.

@bollhals bollhals force-pushed the feature/perf.counters branch from 04b007b to 6e6ab3e Compare March 18, 2021 18:02
@bollhals
Copy link
Contributor Author

@bollhals can you please rebase this on top of master? Then we can merge.

done, when the build is still successful, we can merge.

@michaelklishin michaelklishin merged commit 3299fcf into rabbitmq:master Mar 23, 2021
@bollhals bollhals deleted the feature/perf.counters branch March 23, 2021 22:26
@xsoheilalizadeh
Copy link

I'm not able to read these metrics, by dotnet monitor. I'm using Masstranist with Rabbitmq transport, I tried rabbitmq-client and rabbitmq-dotnet-client for the counter name but It didn't work out. Does anyone have any idea how can I enable this?

@bollhals
Copy link
Contributor Author

I'm not sure whether this is in the 6.x branch or is yet to be released.

@xsoheilalizadeh
Copy link

@bollhals When this is going to be merged or released?

@lukebakken
Copy link
Contributor

lukebakken commented Sep 20, 2022

@xsoheilalizadeh - I suggest checking out the master branch and compiling this library yourself. We didn't plan to back-port this to 6.x, but I could do that.

@Gsantomaggio @michaelklishin back port?

@xsoheilalizadeh
Copy link

Unfortunately, that's not an option for me.

@michaelklishin
Copy link
Member

@lukebakken given that this is a feature and not a bug, maybe we should ship 7.0 sooner. I wouldn't be against backporting but again, it is not a bug fix and this community cares a lot about us following the strict interpretation of SemVer.

@bollhals
Copy link
Contributor Author

Up to you guys. Irrespective pf this, I'd advise to start a thread about 7.0 and the remaining work so anyone has the same understanding and the community knows what/when to expect.

@lukebakken
Copy link
Contributor

@bollhals please discuss here - #1191

@xsoheilalizadeh
Copy link

Do you have any ETA for 7.0 release?

@lukebakken
Copy link
Contributor

No we do not.

@eerhardt
Copy link
Contributor

eerhardt commented Nov 1, 2023

Also updated the event source name to rabbitmq-client

@bollhals @lukebakken @michaelklishin - is there a reason the event source name was changed from rabbitmq-dotnet-client to rabbitmq-client? This is a breaking change for anyone who is listening to these EventSource events when moving from 6.x to 7.0.

@michaelklishin
Copy link
Member

@eerhardt having "dotnet" in the name seems redundant. It was introduced for the next major version, I don't think a breaking change in a new major should generally be considered controversial.

@lukebakken
Copy link
Contributor

lukebakken commented Nov 2, 2023

@eerhardt my guess is that since the main namespace for this client is RabbitMQ.Client, that change was made to bring it in line.

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.

6 participants