lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (SOLR-8785) Use Metrics library for core metrics
Date Thu, 24 Mar 2016 20:57:25 GMT


ASF GitHub Bot commented on SOLR-8785:

GitHub user randomstatistic opened a pull request:

    SOLR-8785: Use Metrics library for core metrics

    There were three main areas that used the copied classes in org.apache.solr.util.stats:
      - AnalyticsStatisticsCollector
      - Overseer.Stats
      - RequestHandlerBase
    This patch adds depreciation tags to all the copied classes, and also replaces all usage
of those classes with classes from the Metrics library.
    I added one new class (org.apache.solr.util.stats.Metrics) to provide some common access
patterns for metrics gathering.
    This patch only adds Registry-based tracking to RequestHandlerBase, although all three
areas are a fit for it. The effect is that all one needs to do is add a Reporter to the SharedMetricRegistry
named “solr.registry.requesthandler” and all named request handler stats will be exported
    Compatibility notes:
      - The “totalTime” stat has been deleted from all three areas. This never seemed
very useful, and Metrics didn’t support it in the Timer class, so it would have required
some extra code to keep.
      - RequestHandler stats are now persistent, and will no longer reset on reload.

You can merge this pull request into a Git repository by running:

    $ git pull metrics_lib

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #25
commit 77ba4704399ecd5121a6941a3a75c1294172ed21
Author: Jeff Wartes <>
Date:   2016-03-16T18:27:35Z

    SOLR-8785 - Upgrade Metrics lib

commit 9ad3a8179ac446f5820e051802a37bf8b2ba911b
Author: Jeff Wartes <>
Date:   2016-03-18T02:46:49Z

    SOLR-8785 - Use the Metrics lib instead of the old classes from the org.apache.solr.util.stats
package space.

commit 6ee11c807aa7432ec02f9ad63aefc7487a02566a
Author: Jeff Wartes <>
Date:   2016-03-18T02:55:33Z

    SOLR-8785 - Use persistent, reportable timers for named request handlers


> Use Metrics library for core metrics
> ------------------------------------
>                 Key: SOLR-8785
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 4.1
>            Reporter: Jeff Wartes
> The Metrics library ( is a well-known way
to track metrics about applications. 
> In SOLR-1972, latency percentile tracking was added. The comment list is long, so here’s
my synopsis:
> 1. An attempt was made to use the Metrics library
> 2. That attempt failed due to a memory leak in Metrics v2.1.1
> 3. Large parts of Metrics were then copied wholesale into the org.apache.solr.util.stats
package space and that was used instead.
> Copy/pasting Metrics code into Solr may have been the correct solution at the time, but
I submit that it isn’t correct any more. 
> The leak in Metrics was fixed even before SOLR-1972 was released, and by copy/pasting
a subset of the functionality, we miss access to other important things that the Metrics library
provides, particularly the concept of a Reporter. (
> Further, Metrics v3.0.2 is already packaged with Solr anyway, because it’s used in
two contrib modules. (map-reduce and morphines-core)
> I’m proposing that:
> 1. Metrics as bundled with Solr be upgraded to the current v3.1.2
> 2. Most of the org.apache.solr.util.stats package space be deleted outright, or gutted
and replaced with simple calls to Metrics. Due to the copy/paste origin, the concepts should
mostly map 1:1.
> I’d further recommend a usage pattern like:
> SharedMetricRegistries.getOrCreate(System.getProperty(“solr.metrics.registry”, “solr-registry”))
> There are all kinds of areas in Solr that could benefit from metrics tracking and reporting.
This pattern allows diverse areas of code to track metrics within a single, named registry.
This well-known-name then becomes a handle you can use to easily attach a Reporter and ship
all of those metrics off-box.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message