Interface SolrMetricProducer

    • Method Detail

      • getUniqueMetricTag

        static String getUniqueMetricTag​(Object o,
                                         String parentName)
        Unique metric tag identifies components with the same life-cycle, which should be registered / unregistered together. It is in the format of A:B:C, where A is the parent of B is the parent of C and so on. If object "B" is unregistered C also must get unregistered. If object "A" is unregistered B and C also must get unregistered.
        Parameters:
        o - object to create a tag for
        parentName - parent object name, or null if no parent exists
      • initializeMetrics

        void initializeMetrics​(SolrMetricsContext parentContext,
                               String scope)
        Initialize metrics specific to this producer.
        Parameters:
        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 object.
        scope - component scope
      • getSolrMetricsContext

        SolrMetricsContext getSolrMetricsContext()
        Implementations should return the context used in initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics at the end of the life-cycle of this component. This should be the child context if one was created, or null if the parent context was used.
      • close

        default void close()
                    throws IOException
        Implementations should always call 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.

        Specified by:
        close in interface AutoCloseable
        Throws:
        IOException