Package org.apache.solr.metrics
Class SolrCoreMetricManager
java.lang.Object
org.apache.solr.metrics.SolrCoreMetricManager
- All Implemented Interfaces:
Closeable,AutoCloseable
Helper class for managing registration of
SolrMetricProducer's specific to a SolrCore instance.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes reporters specific to this core and unregisters gauges with this core's instance tag.static StringcreateRegistryName(boolean cloud, String collectionName, String shardName, String replicaName, String coreName) static StringcreateRegistryName(SolrCore aCore, String coreName) This method is used byCoreContainer.rename(String, String).getCore()Metric registry name of the manager.voidregisterMetricProducer(SolrMetricProducer producer, io.opentelemetry.api.common.Attributes attributes) Registers a mapping of name/metric's with the manager's metric registry and creates the base set of attributes for core level metrics.voidRe-register all metric producers associated with this core.
-
Field Details
-
COLLECTION_ATTR
-
CORE_ATTR
-
SHARD_ATTR
-
REPLICA_TYPE_ATTR
-
-
Constructor Details
-
SolrCoreMetricManager
Constructs a metric manager.- Parameters:
core- the metric manager's core
-
-
Method Details
-
reregisterCoreMetrics
public void reregisterCoreMetrics()Re-register all metric producers associated with this core. This recreates the metric registry resetting its state and recreating its attributes for all tracked registered producers. -
registerMetricProducer
public void registerMetricProducer(SolrMetricProducer producer, io.opentelemetry.api.common.Attributes attributes) Registers a mapping of name/metric's with the manager's metric registry and creates the base set of attributes for core level metrics. All metric producers are tracked for re-registering in the case of core swapping/renaming- Parameters:
producer- producer of metrics to be registered
-
close
Closes reporters specific to this core and unregisters gauges with this core's instance tag.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getSolrMetricsContext
-
getCore
-
getRegistryName
Metric registry name of the manager.In order to make it easier for reporting tools to aggregate metrics from different cores that logically belong to a single collection we convert the core name into a dot-separated hierarchy of: collection name, shard name (with optional split) and replica name.
For example, when the core name looks like this but it's NOT a SolrCloud collection:
my_collection_shard1_1_replica1then this will be used as the registry name (plus the requiredsolr.coreprefix). However, if this is a SolrCloud collectionmy_collectionthen the registry name will becomesolr.core.my_collection.shard1_1.replica1.- Returns:
- the metric registry name of the manager.
-
createRegistryName
-
createRegistryName
This method is used byCoreContainer.rename(String, String).- Parameters:
aCore- existing core with old namecoreName- new name- Returns:
- new registry name
-