public interface SolrMetricProducer extends AutoCloseable
SolrMetricManager
.Modifier and Type | Method and Description |
---|---|
default void |
close()
Implementations should always call
SolrMetricProducer.super.close() to ensure that
metrics with the same life-cycle as this component are properly unregistered. |
default SolrMetricsContext |
getSolrMetricsContext()
Implementing classes should override this method to provide the context obtained in
initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component. |
static String |
getUniqueMetricTag(Object o,
String parentName)
Unique metric tag identifies components with the same life-cycle, which should
be registered / unregistered together.
|
default void |
initializeMetrics(SolrMetricManager manager,
String registry,
String tag,
String scope)
Deprecated.
use
initializeMetrics(SolrMetricsContext, String) instead |
default void |
initializeMetrics(SolrMetricsContext parentContext,
String scope)
Initialize metrics specific to this producer.
|
static String getUniqueMetricTag(Object o, String parentName)
o
- object to create a tag forparentName
- parent object name, or null if no parent exists@Deprecated default void initializeMetrics(SolrMetricManager manager, String registry, String tag, String scope)
initializeMetrics(SolrMetricsContext, String)
insteadmanager
- an instance of SolrMetricManager
registry
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer,
or a group of related instances that have the same life-cycle. This tag is
used when managing life-cycle of some metrics.scope
- scope of the metrics (eg. handler name) to separate metrics of components with
the same implementation but different scope.default void initializeMetrics(SolrMetricsContext parentContext, String scope)
parentContext
- parent metrics context. If this component has the same life-cycle as the parent
it can simply use the parent context, otherwise it should obtain a child context
using SolrMetricsContext.getChildContext(Object)
passing this
as the child.scope
- component scopedefault SolrMetricsContext getSolrMetricsContext()
initializeMetrics(SolrMetricsContext, String)
to ensure proper cleanup of metrics
at the end of the life-cycle of this component.default void close() throws IOException
SolrMetricProducer.super.close()
to ensure that
metrics with the same life-cycle as this component are properly unregistered. This prevents
obscure memory leaks.
from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
While this interface method is declared to throw Exception, implementers are strongly encouraged
to declare concrete implementations of the close method to throw more specific exceptions, or to
throw no exception at all if the close operation cannot fail.close
in interface AutoCloseable
IOException
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.