maedhroz commented on code in PR #2534:
URL: https://github.com/apache/cassandra/pull/2534#discussion_r1310841213
##########
src/java/org/apache/cassandra/service/accord/AccordStateCache.java:
##########
@@ -66,22 +60,27 @@ static class Stats
private int unreferenced = 0;
private long maxSizeInBytes;
private long bytesCached = 0;
- private final Stats stats = new Stats();
+ private final String metricsScope;
+
+ @VisibleForTesting
+ final AccordStateCacheMetrics metrics;
- public AccordStateCache(ExecutorPlus loadExecutor, ExecutorPlus
saveExecutor, long maxSizeInBytes)
+ public AccordStateCache(ExecutorPlus loadExecutor, ExecutorPlus
saveExecutor, long maxSizeInBytes, String metricsScope)
{
this.loadExecutor = loadExecutor;
this.saveExecutor = saveExecutor;
this.maxSizeInBytes = maxSizeInBytes;
+ this.metricsScope = metricsScope;
+ this.metrics = new AccordStateCacheMetrics(String.format("%s-global",
metricsScope), this);
Review Comment:
Assuming we only need global stats, or global stats and stats broken down by
instance, would it be easier to just create 3 singleton instances of
`AccordStateCacheMetrics` and reuse them across all command stores? I'm not
sure whether this actually ends up constituting any correctness problems w/
multiple stores active (although I don't think we have any tests that cover
this yet, as `AccordStateCacheTest` is more of a unit test), but it does seem
like we would be doing a lot of duplicate MBean registration (or at least
needless attempts at re-registration) in `registerMBean()`...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]