[improve][client] Client add permits metric#22390
[improve][client] Client add permits metric#22390crossoverJie wants to merge 5 commits intoapache:masterfrom
Conversation
| "The number of messages currently sitting in the consumer receive queue", topic, attrs); | ||
| bytesPrefetchedGauge = ip.newUpDownCounter("pulsar.client.consumer.receive_queue.size", Unit.Bytes, | ||
| "The total size in bytes of messages currently sitting in the consumer receive queue", topic, attrs); | ||
| messageAvailablePermitsGauge = ip.newUpDownCounter("pulsar.client.consumer.available_permits.count", |
There was a problem hiding this comment.
If you copied from above you need to notice .count was added since there are two sub-metrics for receive_queue. In yours you only have one.
Also, thinking about available. Maybe if we know the limit:
pulsar.client.consumer.permit.remaining
pulsar.client.consumer.permit.limit
if we don't know the limit then maybe just ``pulsar.client.consumer.permits.remaining`
See naming guidelines here https://opentelemetry.io/docs/specs/semconv/general/metrics/
There was a problem hiding this comment.
If you copied from above you need to notice
.countwas added since there are two sub-metrics forreceive_queue. In yours you only have one.
I noticed that .size is the data of the message body, but permits is just a counter and does not have a size itself, so .size may not be needed.
Also, thinking about available. Maybe if we know the limit:
pulsar.client.consumer.permit.remainingpulsar.client.consumer.permit.limit
pulsar.client.consumer.permit.remaining= getCurrentReceiverQueueSize() / 2- available
pulsar.client.consumer.permit.limit= getCurrentReceiverQueueSize() / 2
Do you mean this?
There was a problem hiding this comment.
Yes.
Also I didn't write that size is needed :) Only that we don't need .count and added suggestion how to name it.
There was a problem hiding this comment.
Thank you for your follow-up, the changes have been made.
PTAL.
# Conflicts: # pulsar-client/src/main/java/org/apache/pulsar/client/impl/metrics/UpDownCounter.java
Motivation
Added a new dimensional metric to help better monitor clients.
Modifications
Add
pulsar.client.consumer.available_permits.countmetric.Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: crossoverJie#23