Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ Improvements

* SOLR-13763: Improve the tracking of "freedisk" in autoscaling simulations. (ab)

* SOLR-13773: Add Prometheus Exporter GC and Heap options. (Houston Putman via Anshum Gupta, David Smiley)

Bug Fixes
----------------------

Expand Down
23 changes: 21 additions & 2 deletions solr/contrib/prometheus-exporter/bin/solr-exporter
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,23 @@ do
CLASSPATH="$CLASSPATH":"$JAR"
done

EXTRA_JVM_ARGUMENTS="-Xmx512m -Dlog4j.configurationFile=file:"$BASEDIR"/../../server/resources/log4j2-console.xml"
# Memory settings
JAVA_MEM_OPTS=
if [ -z "$JAVA_HEAP" ] && [ -n "$JAVA_MEM" ]; then
JAVA_MEM_OPTS="$JAVA_MEM"
else
JAVA_HEAP="${JAVA_HEAP:-512m}"
JAVA_MEM_OPTS="-Xms$JAVA_HEAP -Xmx$JAVA_HEAP"
fi

# define default GC_TUNE
if [ -z ${GC_TUNE+x} ]; then
GC_TUNE='-XX:+UseG1GC'
else
GC_TUNE="$GC_TUNE"
fi

EXTRA_JVM_ARGUMENTS="-Dlog4j.configurationFile=file:"$BASEDIR"/../../server/resources/log4j2-console.xml"

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
Expand All @@ -115,7 +131,10 @@ if $cygwin; then
[ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"`
fi

exec "$JAVACMD" $JAVA_OPTS \
exec "$JAVACMD" \
$JAVA_MEM_OPTS \
$GC_TUNE \
$JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS \
-classpath "$CLASSPATH" \
-Dapp.name="solr-exporter" \
Expand Down
7 changes: 5 additions & 2 deletions solr/contrib/prometheus-exporter/bin/solr-exporter.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,22 @@ set BASEDIR=%~dp0..

:repoSetup

IF NOT "%JAVA_HEAP%"=="" set JAVA_MEM=-Xms%JAVA_HEAP% -Xmx%JAVA_HEAP%
IF "%JAVA_MEM%"=="" set JAVA_MEM=-Xms512m -Xmx512m
IF "%GC_TUNE%"=="" set GC_TUNE=-XX:+UseG1GC

if "%JAVACMD%"=="" set JAVACMD=java

if "%REPO%"=="" set REPO=%BASEDIR%\lib

set CLASSPATH=%REPO%\*;%BASEDIR%\..\..\dist\solrj-lib\*;%BASEDIR%\..\..\dist\*;%BASEDIR%\lucene-libs\*;%BASEDIR%\..\..\server\solr-webapp\webapp\WEB-INF\lib\*
set EXTRA_JVM_ARGUMENTS=-Xmx512m -Dlog4j.configurationFile=file:///%BASEDIR%\..\..\server\resources\log4j2-console.xml
set EXTRA_JVM_ARGUMENTS=-Dlog4j.configurationFile=file:///%BASEDIR%\..\..\server\resources\log4j2-console.xml
goto endInit

@REM Reaching here means variables are defined and arguments have been captured
:endInit

%JAVACMD% %JAVA_OPTS% %EXTRA_JVM_ARGUMENTS% -classpath "%CLASSPATH_PREFIX%;%CLASSPATH%" -Dapp.name="solr-exporter" -Dapp.repo="%REPO%" -Dbasedir="%BASEDIR%" org.apache.solr.prometheus.exporter.SolrExporter %CMD_LINE_ARGS%
%JAVACMD% %JAVA_MEM% %GC_TUNE% %JAVA_OPTS% %EXTRA_JVM_ARGUMENTS% -classpath "%CLASSPATH_PREFIX%;%CLASSPATH%" -Dapp.name="solr-exporter" -Dapp.repo="%REPO%" -Dbasedir="%BASEDIR%" org.apache.solr.prometheus.exporter.SolrExporter %CMD_LINE_ARGS%
if ERRORLEVEL 1 goto error
goto end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,28 @@ The number of seconds between collecting metrics from Solr. The `solr-exporter`

The Solr's metrics exposed by `solr-exporter` can be seen at: `\http://localhost:9983/solr/admin/metrics`.

=== Getting metrics from a secure Solr(Cloud)
=== Environment Variable Options

The start commands provided with the Prometheus Exporter support the use of custom java options through the following environment variables:

`JAVA_HEAP`::
Sets the initial (`Xms`) and max (`Xmx`) Java heap size. The default is `512m`.

`JAVA_MEM`::
Custom java memory settings (e.g. `-Xms1g -Xmx2g`). This is ignored if `JAVA_HEAP` is provided.

Your Solr(Cloud) might be secured by measures described in <<securing-solr.adoc#securing-solr,Securing Solr>>. The security configuration can be injected into `solr-exporter` using environment variables in a fashion similar to other clients using <<using-solrj.adoc#using-solrj,SolrJ>>. This is possible because the main script picks up two external environment variables and passes them on to the Java process:
`GC_TUNE`::
Custom Java garbage collection settings. The default is `-XX:+UseG1GC`.

`JAVA_OPTS`::
Extra JVM options.

`CLASSPATH_PREFIX`::
Location of extra libraries to load when starting the `solr-exporter`.

=== Getting metrics from a secure Solr(Cloud)

* `JAVA_OPTS` allows to add extra JVM options
* `CLASSPATH_PREFIX` allows to add extra libraries
Your Solr(Cloud) might be secured by measures described in <<securing-solr.adoc#securing-solr,Securing Solr>>. The security configuration can be injected into `solr-exporter` using environment variables in a fashion similar to other clients using <<using-solrj.adoc#using-solrj,SolrJ>>. This is possible because the main script picks up <<Environment Variable Options>> and passes them on to the Java process.

Example for a SolrCloud instance secured by <<basic-authentication-plugin.adoc#basic-authentication-plugin,Basic Authentication>>, <<enabling-ssl.adoc#enabling-ssl,SSL>> and <<zookeeper-access-control.adoc#zookeeper-access-control,ZooKeeper Access Control>>:

Expand Down