[ 
https://issues.apache.org/jira/browse/SOLR-9898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15782953#comment-15782953
 ] 

Andrzej Bialecki  commented on SOLR-9898:
-----------------------------------------

h2. Reporters
Reporter configurations are specified in {{solr.xml}} file in 
{{<metrics><reporter>}} sections, for example:
{code}
<solr>
 <metrics>
  <reporter name="graphite" group="node, jvm" 
class="org.apache.solr.metrics.reporters.SolrGraphiteReporter">
    <str name="host">graphite-server</str>
    <int name="port">9999</int>
    <int name="period">60</int>
  </reporter>
  <reporter name="collection1Updates" registry="solr.core.collection1" 
class="org.apache.solr.metrics.reporters.SolrSlf4jReporter">
    <int name="period">300</int>
    <str name="prefix">example</str>
    <str name="logger">updatesLogger</str>
    <str name="filter">QUERYHANDLER./update</str>
  </reporter>  
 </metrics>
...
</solr>
{code}
Reporter plugins use the following attributes:
* *name* - (required) unique name of the reporter plugin
* *class* - (required) fully-qualified implementation class of the plugin, must 
extend {{SolrMetricReporter}}
* *group* - (optional) one or more of the predefined groups (see above)
* *registry* - (optional) one or more of valid fully-qualified registry names

If both {{group}} and {{registry}} attributes are specified only the {{group}} 
attribute is considered. If neither attribute is specified then the plugin will 
be used for all groups and registries. Multiple group or registry names can be 
specified, separated by comma and/or space.

Additionally, several implementation-specific initialization arguments can be 
specified in nested elements. There are some arguments that are common to 
SLF4J, Ganglia and Graphite reporters:
* *period* - (optional int) period in seconds between reports. Default value is 
60.
* *prefix* - (optional str) prefix to be added to metric names, may be helpful 
in logical grouping of related Solr instances, eg. machine name or cluster 
name. Default is empty string, ie. just the registry name and metric name will 
be used to form a fully-qualified metric name.
* *filter* - (optional str) if not empty then only metric names that start with 
this value will be reported. Default is no filtering, ie. all metrics from 
selected registry will be reported.

Reporters are instantiated for every group and registry that they were 
configured for, at the time when the respective components are initialized (eg. 
on JVM startup or SolrCore load). When reporters are created their 
configuration is validated (and eg. necessary connections are established). 
Uncaught errors at this initialization stage cause the reporter to be discarded 
from the running configuration. Reporters are closed when the corresponding 
component is being closed (eg. on SolrCore close, or JVM shutdown) but metrics 
that they reported are still maintained in respective registries, as explained 
in the previous section.

The following sections provide information on implementation-specific 
arguments. All implementation classes provided with Solr can be found under 
{{org.apache.solr.metrics.reporters}}.

h3. JMX reporter ({{org.apache.solr.metrics.reporters.SolrJmxReporter}})
* *domain* - (optional str) JMX domain name. If not specified then registry 
name will be used.
* *serviceUrl* - (optional str) service URL for a JMX server. If not specified 
then the default platform MBean server will be used.
* *agentId* - (optional str) agent ID for a JMX server. Note: either 
{{serviceUrl}} or {{agentId}} can be specified but not both - if both are 
specified then the default MBean server will be used.

Object names created by this reporter are hierarchical, dot-separated but also 
properly structured to form corresponding hierarchies in eg. JConsole. This 
hierarchy consists of the following elements in the top-down order:
* registry name (eg. {{solr.core.collection1.shard1.replica1}}. Dot-separated 
registry names are also split into ObjectName hierarchy levels, so that metrics 
for this registry will be shown under 
{{/solr/core/collection1/shard1/replica1}} in JConsole, with each domain part 
being assigned to {{dom1, dom2, ... domN}} property.
* reporter name (the value of reporter's {{name}} attribute)
* category, scope and name for request handlers
* or additional {{name1, name2, ... nameN}} elements for metrics from other 
components.

h3. SLF4J reporter ({{org.apache.solr.metrics.reporters.SolrSlf4jReporter}})
(See also common arguments above)
* *logger* - (optional str) name of the logger to use. Default is empty, in 
which case the group or registry name will be used if specified in the plugin 
configuration.

Users can specify logger name (and the corresponding logger configuration in 
eg. Log4j configuration) to output metrics-related logging to separate file(s), 
which can then be processed by external applications. Each log line produced by 
this reporter consists of configuration-specific fields, and a message that 
follows this format:
{code}
type=COUNTER, name={}, count={}

type=GAUGE, name={}, value={}

type=TIMER, name={}, count={}, min={}, max={}, mean={}, stddev={}, median={}, 
p75={}, p95={}, p98={}, p99={}, p999={}, mean_rate={}, m1={}, m5={}, m15={}, 
rate_unit={}, duration_unit={}

type=METER, name={}, count={}, mean_rate={}, m1={}, m5={}, m15={}, rate_unit={}

type=HISTOGRAM, name={}, count={}, min={}, max={}, mean={}, stddev={}, 
median={}, p75={}, p95={}, p98={}, p99={}, p999={}
{code}
(curly braces added only as placeholders for actual values).

h3. [Graphite|https://graphiteapp.org/] reporter 
({{org.apache.solr.metrics.reporters.SolrGraphiteReporter}})
(See also common arguments above)
* *host* - (required str) host name where Graphite server is running.
* *port* - (required int) port number for the server
* *pickled* - (optional bool) use "pickled" Graphite protocol which may be more 
efficient. Default is false (use plain-text protocol).

When plain-text protocol is used ({{pickled==false}}) it's possible to use this 
reporter to integrate with systems other than Graphite, if they can accept 
space-separated and line-oriented input over network in the following format:
{code}
dot.separated.metric.name[.and.attribute] value epochTimestamp
{code}
For example:
{code}
example.solr.node.cores.lazy 0 1482932097
example.solr.node.cores.loaded 1 1482932097
example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.count
 21 1482932097
example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m1_rate
 2.5474287707930614 1482932097
example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m5_rate
 3.8003171557510305 1482932097
example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m15_rate
 4.0623076220244245 1482932097
example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.mean_rate
 0.5698031798408144 1482932097
{code}

h3. [Ganglia|http://ganglia.info] reporter 
({{org.apache.solr.metrics.reporters.SolrGangliaReporter}})
(See also common arguments above)
* *host* - (required str) host name where Ganglia server is running.
* *port* - (required int) port number for the server
* *multicast* - (optional bool) when true use multicast UDP communication, 
otherwise use UDP unicast. Default is false.


> Documentation for metrics collection and /admin/metrics
> -------------------------------------------------------
>
>                 Key: SOLR-9898
>                 URL: https://issues.apache.org/jira/browse/SOLR-9898
>             Project: Solr
>          Issue Type: Task
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: master (7.0), 6.4
>            Reporter: Andrzej Bialecki 
>
> Draft documentation follows.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to