You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2018/03/06 17:28:43 UTC

[6/8] lucene-solr:jira/solr-11670-2: SOLR-11795: use README.txt rather than .md and add description for default values

SOLR-11795: use README.txt rather than .md and add description for default values


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/122271f2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/122271f2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/122271f2

Branch: refs/heads/jira/solr-11670-2
Commit: 122271f28deb739e3d7fe84c86c6a359d367abd8
Parents: 4bdc99a
Author: koji <ko...@apache.org>
Authored: Tue Mar 6 17:14:15 2018 +0900
Committer: koji <ko...@apache.org>
Committed: Tue Mar 6 17:14:15 2018 +0900

----------------------------------------------------------------------
 solr/contrib/prometheus-exporter/README.md      |  21 ----
 solr/contrib/prometheus-exporter/README.txt     |  22 +++-
 .../solr/prometheus/exporter/SolrExporter.java  |  13 +-
 ...toring-solr-with-prometheus-and-grafana.adoc | 120 ++++++++++++-------
 4 files changed, 102 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/122271f2/solr/contrib/prometheus-exporter/README.md
----------------------------------------------------------------------
diff --git a/solr/contrib/prometheus-exporter/README.md b/solr/contrib/prometheus-exporter/README.md
deleted file mode 100644
index 888f237..0000000
--- a/solr/contrib/prometheus-exporter/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-Welcome to Apache Solr Prometheus Exporter
-========
-
-Apache Solr Prometheus Exporter (solr-exporter) provides a way for you to expose metrics for Solr to Prometheus.
-
-# Getting Started With Solr Prometheus Exporter
-
-For information on how to get started with solr-exporter please see:
- * [Solr Reference Guide's section on Monitoring Solr with Prometheus and Grafana](https://lucene.apache.org/solr/guide/monitoring-solr-with-prometheus-and-grafana.html)
-
-# Getting Started With Solr
-
-For information on how to get started with solr please see:
- * [solr/README.txt](../../README.txt)
- * [Solr Tutorial](https://lucene.apache.org/solr/guide/solr-tutorial.html)
-
-# How To Contribute
-
-For information on how to contribute see:
- * http://wiki.apache.org/lucene-java/HowToContribute
- * http://wiki.apache.org/solr/HowToContribute

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/122271f2/solr/contrib/prometheus-exporter/README.txt
----------------------------------------------------------------------
diff --git a/solr/contrib/prometheus-exporter/README.txt b/solr/contrib/prometheus-exporter/README.txt
index 42061c0..888f237 100644
--- a/solr/contrib/prometheus-exporter/README.txt
+++ b/solr/contrib/prometheus-exporter/README.txt
@@ -1 +1,21 @@
-README.md
\ No newline at end of file
+Welcome to Apache Solr Prometheus Exporter
+========
+
+Apache Solr Prometheus Exporter (solr-exporter) provides a way for you to expose metrics for Solr to Prometheus.
+
+# Getting Started With Solr Prometheus Exporter
+
+For information on how to get started with solr-exporter please see:
+ * [Solr Reference Guide's section on Monitoring Solr with Prometheus and Grafana](https://lucene.apache.org/solr/guide/monitoring-solr-with-prometheus-and-grafana.html)
+
+# Getting Started With Solr
+
+For information on how to get started with solr please see:
+ * [solr/README.txt](../../README.txt)
+ * [Solr Tutorial](https://lucene.apache.org/solr/guide/solr-tutorial.html)
+
+# How To Contribute
+
+For information on how to contribute see:
+ * http://wiki.apache.org/lucene-java/HowToContribute
+ * http://wiki.apache.org/solr/HowToContribute

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/122271f2/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
----------------------------------------------------------------------
diff --git a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
index 752f176..01ebd74 100644
--- a/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
+++ b/solr/contrib/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
@@ -56,31 +56,31 @@ public class SolrExporter {
   private static final String ARG_PORT_METAVAR = "PORT";
   private static final String ARG_PORT_DEST = "port";
   private static final Integer ARG_PORT_DEFAULT = 9983;
-  private static final String ARG_PORT_HELP = "solr-exporter listen port";
+  private static final String ARG_PORT_HELP = "Specify the solr-exporter HTTP listen port; default is " + String.valueOf(ARG_PORT_DEFAULT) + ".";
 
   private static final String[] ARG_BASE_URL_FLAGS = { "-b", "--baseurl" };
   private static final String ARG_BASE_URL_METAVAR = "BASE_URL";
   private static final String ARG_BASE_URL_DEST = "baseUrl";
   private static final String ARG_BASE_URL_DEFAULT = "";
-  private static final String ARG_BASE_URL_HELP = "specify Solr base URL when connecting to Solr in standalone mode (for example 'http://localhost:8983/solr')";
+  private static final String ARG_BASE_URL_HELP = "Specify the Solr base URL when connecting to Solr in standalone mode. If omitted both the -b parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'http://localhost:8983/solr'.";
 
   private static final String[] ARG_ZK_HOST_FLAGS = { "-z", "--zkhost" };
   private static final String ARG_ZK_HOST_METAVAR = "ZK_HOST";
   private static final String ARG_ZK_HOST_DEST = "zkHost";
   private static final String ARG_ZK_HOST_DEFAULT = "";
-  private static final String ARG_ZK_HOST_HELP = "specify ZooKeeper connection string when connecting to Solr in SolrCloud mode (for example 'localhost:2181/solr')";
+  private static final String ARG_ZK_HOST_HELP = "Specify the ZooKeeper connection string when connecting to Solr in SolrCloud mode. If omitted both the -b parameter and the -z parameter, connect to http://localhost:8983/solr. For example 'localhost:2181/solr'.";
 
   private static final String[] ARG_CONFIG_FLAGS = { "-f", "--config-file" };
   private static final String ARG_CONFIG_METAVAR = "CONFIG";
   private static final String ARG_CONFIG_DEST = "configFile";
   private static final String ARG_CONFIG_DEFAULT = "./conf/solr-exporter-config.xml";
-  private static final String ARG_CONFIG_HELP = "specify configuration file";
+  private static final String ARG_CONFIG_HELP = "Specify the configuration file; default is " + ARG_CONFIG_DEFAULT + ".";
 
-  private static final String[] ARG_NUM_THREADS_FLAGS = { "-n", "--num-thread" };
+  private static final String[] ARG_NUM_THREADS_FLAGS = { "-n", "--num-threads" };
   private static final String ARG_NUM_THREADS_METAVAR = "NUM_THREADS";
   private static final String ARG_NUM_THREADS_DEST = "numThreads";
   private static final Integer ARG_NUM_THREADS_DEFAULT = 1;
-  private static final String ARG_NUM_THREADS_HELP = "specify number of threads";
+  private static final String ARG_NUM_THREADS_HELP = "Specify the number of threads. solr-exporter creates a thread pools for request to Solr. If you need to improve request latency via solr-exporter, you can increase the number of threads; default is " + String.valueOf(ARG_NUM_THREADS_DEFAULT) + ".";
 
   private int port;
   private SolrClient solrClient;
@@ -135,7 +135,6 @@ public class SolrExporter {
   public void stop() {
     this.httpServer.stop();
     this.registry.unregister(this.collector);
-//    this.collector.shutdown();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/122271f2/solr/solr-ref-guide/src/monitoring-solr-with-prometheus-and-grafana.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/monitoring-solr-with-prometheus-and-grafana.adoc b/solr/solr-ref-guide/src/monitoring-solr-with-prometheus-and-grafana.adoc
index 0d5295b..5348cfb 100644
--- a/solr/solr-ref-guide/src/monitoring-solr-with-prometheus-and-grafana.adoc
+++ b/solr/solr-ref-guide/src/monitoring-solr-with-prometheus-and-grafana.adoc
@@ -25,6 +25,7 @@ image::images/monitoring-solr-with-prometheus-and-grafana/solr-exporter-diagram.
 
 This feature is experimental status.
 
+
 == Running solr-exporter
 
 You can start solr-exporter by running `./bin/solr-exporter` from the solr-exporter directory.
@@ -56,26 +57,28 @@ See command help:
 [source,plain]
 ----
 $ ./bin/solr-exporter -h
-usage: SolrCollector [-h] [-v] [-p PORT] [-b BASE_URL] [-z ZK_HOST] [-f CONFIG]
-                     [-n NUM_THREADS]
-
-Prometheus exporter for Apache Solr.
-
-optional arguments:
-  -h, --help             show this help message and exit
-  -p PORT, --port PORT   solr-exporter listen port
-  -b BASE_URL, --baseurl BASE_URL
-                         specify Solr base URL when connecting  to Solr in standalone mode (for
-                         example 'http://localhost:8983/solr')
-  -z ZK_HOST, --zkhost ZK_HOST
-                         specify  ZooKeeper  connection  string  when  connecting  to  Solr  in
-                         SolrCloud mode (for example 'localhost:2181/solr')
-  -f CONFIG, --config-file CONFIG
-                         specify configuration file
-  -n NUM_THREADS, --num-thread NUM_THREADS
-                         specify number of threads
 ----
 
+=== Command Line Parameters
+
+`-p`, `--port`::
+Specify the solr-exporter HTTP listen port; default is `9983`.
+
+`-b`, `--baseurl`::
+Specify the Solr base URL when connecting to Solr in standalone mode. If omitted both the `-b` parameter and the `-z` parameter, connect to `http://localhost:8983/solr`. For example `http://localhost:8983/solr`.
+
+`-z`, `--zkhost`::
+Specify the ZooKeeper connection string when connecting to Solr in SolrCloud mode. If omitted both the `-b` parameter and the `-z` parameter, connect to `http://localhost:8983/solr`. For example `localhost:2181/solr`.
+
+`-f`, `--config-file`::
+Specify the configuration file; default is `./conf/solr-exporter-config.xml`.
+
+`-n`, `--num-threads`::
+Specify the number of threads. solr-exporter creates a thread pools for request to Solr. If you need to improve request latency via solr-exporter, you can increase the number of threads; default is `1`.
+
+
+== Metrics Exposition URL
+
 The Solr's metrics exposed by solr-exporter can see at the following URL.
 
 http://localhost:9983/metrics[http://localhost:9983/metrics]
@@ -217,32 +220,70 @@ The configuration is in `./config/solr-exporter-config.xml`. An example with all
 </config>
 ----
 
-|===
-|Name|Description
+===  solr-exporter Configuration Tags and Elements
+
+`/config/rules/ping`::
+Scrape <<ping.adoc#ping,Ping>> response.
+
+`/config/rules/metrics`::
+Scrape <<metrics-reporting.adoc#metrics-api,Metrics API>> response.
+
+`/config/rules/collections`::
+Scrape <<collections-api.adoc#collections-api,Collections API>> response.
+
+`/config/rules/search`::
+Scrape <<searching.adoc#searching,Search API>> response.
+
+`*[@query]`::
+Query parameter for each features. You can specify `collection`, `core`, `path`, and `params`.
 
-|ping|Scrape <<ping.adoc#ping,Ping>> response.
-|metrics|Scrape <<metrics-reporting.adoc#metrics-api,Metrics API>> response.
-|collections|Scrape <<collections-api.adoc#collections-api,Collections API>> response.
-|search|Scrape <<searching.adoc#searching,Search API>> response.
-|*.query|Query parameter for each features. You can specify `collection`, `core`, `path`, and `params`.
-|*.jsonQueries|JSON Query that is jq syntax. For more details, see https://stedolan.github.io/jq/manual/[https://stedolan.github.io/jq/manual/].
-|===
+`*[@jsonQueries]`::
+JSON Query that is jq syntax. For more details, see https://stedolan.github.io/jq/manual/[https://stedolan.github.io/jq/manual/].
 
 jq query has to output JSON in the following format.
 
 [source,json]
 ----
 {
-  name         : "solr_ping",
-  type         : "GAUGE",
-  help         : "See following URL: https://lucene.apache.org/solr/guide/ping.html",
-  label_names  : ["base_url","core"],
-  label_values : ["http://localhost:8983/solr","collection1"],
-  value        : 1.0
+  "name"         : "solr_ping",
+  "type"         : "GAUGE",
+  "help"         : "See following URL: https://lucene.apache.org/solr/guide/ping.html",
+  "label_names"  : ["base_url","core"],
+  "label_values" : ["http://localhost:8983/solr","collection1"],
+  "value"        : 1.0
 }
 ----
 
-It will be converted to the following exposition format.
+===  solr-exporter Exposition Format
+
+solr-exporter converts the JSON to the following exposition format:
+
+[source,plain]
+----
+# TYPE <name> <type>
+# HELP <name> <help>
+<name>{<label_names[0]>=<label_values[0]>,<label_names[1]>=<labelvalues[1]>,...} <value>
+----
+
+`name`::
+The metric name to set. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
+
+`type`::
+The type of the metric, can be `COUNTER`, `GAUGE`, `SUMMARY`, `HISTOGRAM` or `UNTYPED`. For more detauils, see https://prometheus.io/docs/concepts/metric_types/[https://prometheus.io/docs/concepts/metric_types/].
+
+`help`::
+Help text for the metric.
+
+`label_names`::
+Label names for the metric. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
+
+`label_values`::
+Label values for the metric. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
+
+`value`::
+Value for the metric. Value must be set to Double type.
+
+For example, solr-exporter converts the above JSON to the following:
 
 [source,plain]
 ----
@@ -251,17 +292,6 @@ It will be converted to the following exposition format.
 solr_ping{base_url="http://localhost:8983/solr",core="collection1"} 1.0
 ----
 
-|===
-|Name|Description
-
-|name|The metric name to set. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
-|type|The type of the metric, can be `COUNTER`, `GAUGE`, `SUMMARY`, `HISTOGRAM` or `UNTYPED`. For more detauils, see https://prometheus.io/docs/concepts/metric_types/[https://prometheus.io/docs/concepts/metric_types/].
-|help|Help text for the metric.
-|label_names|Label names for the metric. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
-|label_values|Label values for the metric. For more details, see https://prometheus.io/docs/practices/naming/[https://prometheus.io/docs/practices/naming/].
-|value|Value for the metric. Value must be set to Double type.
-|===
-
 
 == Prometheus Configuration