sigram commented on a change in pull request #2198: URL: https://github.com/apache/lucene-solr/pull/2198#discussion_r556449504
########## File path: solr/core/src/java/org/apache/solr/core/SolrCore.java ########## @@ -1202,26 +1203,26 @@ public void initializeMetrics(SolrMetricsContext parentContext, String scope) { parentContext.gauge(() -> isClosed() ? parentContext.nullString() : getIndexDir(), true, "indexDir", Category.CORE.toString()); parentContext.gauge(() -> isClosed() ? parentContext.nullNumber() : getIndexSize(), true, "sizeInBytes", Category.INDEX.toString()); parentContext.gauge(() -> isClosed() ? parentContext.nullString() : NumberUtils.readableSize(getIndexSize()), true, "size", Category.INDEX.toString()); - if (coreContainer != null) { - final CloudDescriptor cd = getCoreDescriptor().getCloudDescriptor(); - if (cd != null) { - parentContext.gauge(() -> { - if (cd.getCollectionName() != null) { - return cd.getCollectionName(); - } else { - return parentContext.nullString(); - } - }, true, "collection", Category.CORE.toString()); - parentContext.gauge(() -> { - if (cd.getShardId() != null) { - return cd.getShardId(); - } else { - return parentContext.nullString(); - } - }, true, "shard", Category.CORE.toString()); - } + final CloudDescriptor cd = getCoreDescriptor().getCloudDescriptor(); + if (cd != null) { + // TODO + parentContext.gauge(cd::getCollectionName, true, "collection", Category.CORE.toString()); + parentContext.gauge(() -> Objects.requireNonNullElse(cd.getShardId(), parentContext.nullString()), true, "shard", Category.CORE.toString()); + //TODO should this instead be in a core status, or a metric? When do we use which? Review comment: Yeah, metrics today overlap a lot with "status" requests... something to clean up in 9x. Initially the metrics API wasn't able to properly report complex values (esp. when reported via JMX) but this has been fixed around 7.0 or so - support for non-numeric values had to be added specifically to report things like paths, non-numeric state, etc. and for complex properties like eg. system properties, caches, etc. Now it can report basically anything you want. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org