bbejeck commented on code in PR #22267:
URL: https://github.com/apache/kafka/pull/22267#discussion_r3229131201
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStore.java:
##########
@@ -182,7 +182,21 @@ private void registerMetrics() {
);
if (!persistent()) {
StateStoreMetrics.addNumKeysGauge(taskId.toString(), metricsScope,
name(), streamsMetrics,
- (config, now) -> wrapped().approximateNumEntries());
+ (config, now) -> {
+ final InMemoryKeyValueStore inMemoryStore =
findInMemoryKeyValueStore(wrapped());
+ return inMemoryStore != null ?
inMemoryStore.approximateNumEntries() : -1L;
+ }
+ );
+ }
+ }
+
+ private static InMemoryKeyValueStore findInMemoryKeyValueStore(final
StateStore store) {
Review Comment:
So the real problem was that the immediate layer underneath the `wrapped()`
call was not in-memory and we needed to traverse further down the heirarchy to
get to the in-memory store.
--
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]