Skip to content

Conversation

@li4wang
Copy link
Contributor

@li4wang li4wang commented Oct 16, 2025

This PR contains the following changes for supporting client-triggered op count metrics for more visibility of client triggered load and pattern.

  • ServerMetrics.java: Added counter definitions and initialization
  • FinalRequestProcessor.java: Implemented operation counting in the main request processing pipeline
  • ServerMetricsOpCountTest.java: Added unit tests

@li4wang li4wang force-pushed the ZOOKEEPER-4983 branch 4 times, most recently from 2b44c44 to 436ef46 Compare October 21, 2025 02:31
@li4wang li4wang force-pushed the ZOOKEEPER-4983 branch 4 times, most recently from 16b0d7b to b37eefd Compare December 13, 2025 03:56
@li4wang
Copy link
Contributor Author

li4wang commented Dec 13, 2025

@eolivelli @kezhuw @anmolnar Would you mind reviewing the PR? Thanks

/**
* Operation count metrics
*/
TOTAL_OP_COUNT = metricsContext.getCounter("total_op_count");
Copy link
Contributor

Choose a reason for hiding this comment

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

what about adding a common prefix to all these metrics ?

like "frp_" (final request processor) or "final_request_processor_"

This way the metrics are naturally grouped (and when you explore them with Grafana or build a dashboard your life is much easier)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

How about using op_cout as the prefix, so they are grouped and also the name is more concise and readable?

Copy link
Contributor

@PDavid PDavid left a comment

Choose a reason for hiding this comment

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

Many thanks for this improvement, looks really nice already. 👍

I just added some minor questions / comments.

Comment on lines 276 to 278
/**
* Operation count metrics
*/
Copy link
Contributor

@PDavid PDavid Jan 20, 2026

Choose a reason for hiding this comment

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

Just a small / nit question:
Why do we need a JavaDoc comment here for this? I guess this would be some kind of a divider here and we have some examples above, but in this case shouldn't this be a normal (not JavaDoc comment)? 🤔

(I can see that there are already some examples of this above but I think those are also most probably wrong.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Yes, we don't need JavaDoc comment for this. Updated

Comment on lines 587 to 589
/**
* Operation count metrics
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well. Do we need to have this as JavaDoc comment or rather some kind of divider? 🤔

As is right now the JavaDoc (documentation) of TOTAL_OP_COUNT field will be "Operation count metrics". Is this desired?
If we need some kind if divider would it maybe make sense to use a normal (not JavaDoc comment)?

I see that there are mixed examples in this class already.

What do you all think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point. Use the normal comment would be appropriate here. Updated

import org.apache.zookeeper.test.ClientBase;
import org.junit.jupiter.api.Test;

public class ServerMetricsOpCountTest extends ClientBase {
Copy link
Contributor

Choose a reason for hiding this comment

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

Many thanks for adding the test for this. 👍

@li4wang
Copy link
Contributor Author

li4wang commented Jan 21, 2026

@eolivelli @PDavid Thanks for reviewing the PR and providing valuable comments. I've addressed all of them. Would you mind taking a look at it?

@li4wang li4wang requested review from PDavid and removed request for anmolnar and kezhuw January 21, 2026 00:21
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