Mark Miller - Continuing discussion from
I fired up Solr on HDFS with JMX enabled and took a look at the exported mbeans with JConsole. I did not see anything for the block cache.
I'd look at how SolrResourceLoader adds the plugins that it loads to the JmxMonitoredMap.
Been digging deeper into this... metrics are tracked on a per-core basis. Each core has an infoRegistry that is populated in the constructor either directly or from beans that the SolrResourceLoader had previously created. So instead of creating a new Metrics object directly, we will need to create one through the SolrResourceLoader.newInstance(), which is I think what you were suggesting.
The trick here is that we need to create the bean before the SolrCore finishes constructing, but after the HdfsDirectoryFactory (HDF) exists to make sure that it gets registered in time. So basically, in the no-arg HDF constructor is our only option. The problem is that HDF (or any implementation of DirectoryFactory) is not aware of the resource loader or even a SolrConfig to be able to acquire a reference to the resource loader. I'm hesitant to add a setResourceLoader method or similar on DirectoryFactory because that is starting to feel very intrusive, but I also don't see another way to plumb this through.