Home

Awesome

Prometheus Listener for JMeter

Apache JMeter Backend Listener implementation for Prometheus metrics exporting. Both pull-based and push-based models are supported through different implementations.

Installation

Download the latest release or build your own from the source code. Then put jmeter-prometheus-listener-x.x.x.jar to JMETER_HOME/lib/ext directory.

Usage

  1. Add Listener->Backend Listener to your Test Plan.
  2. In the Backend Listener implementation combobox select com.github.kolesnikovm.PrometheusListener for pull-based model or com.github.kolesnikovm.PrometheusPusher for push-based one.
  3. Edit parameters to your taste.

Parameters

These parameters are set in Backend Listener element. All parameters are required. You can also add custom parameters, that will be treated as labels and added to each metric.

ParamTypeDescription
testNameStringCommon label for all metrics in your test
runIdStringCommon label for all metrics in your test
exporterPortintPort for exposing metrics, path /metrics <br/> Only for com.github.kolesnikovm.PrometheusListener implementation
prometheusURLStringPrometheus URL for pushing metrics <br/> Only for com.github.kolesnikovm.PrometheusPusher implementation
samplersRegExpStringRegular expression for filtering sample results
sloLevelsStringBuckets for jmeter_response_time_histogram. Semicolon delimited

Properties

PropertyDefaultComment
prometheus.collect_jvmfalseBoolean parameter for enabling JVM metrics collection
prometheus.collect_assertionsfalseBoolean parameter for enabling assertion results collection
prometheus.quantiles_age10Max age in seconds for Summary collectors' quantiles
prometheus.log_errorsfalseBoolean parameter for enabling extended error logging
prometheus.push_interval5Metrics push interval for com.github.kolesnikovm.PrometheusPusher implementation

Metrics

Every metric has default label set testName, runId, nodeName and also may have some additional labels. Check the table below for details on metrics and their specific labels.

MetricTypeLabelsComment
jmeter_active_threadsGauge
jmeter_running_threadsGaugethreadGroup
jmeter_requestsCounterrequestName, requestStatus, responseCode, responseMessage, isTransaction
jmeter_response_timeSummaryrequestName, requestStatus, responseCode, responseMessage, isTransactionUnit: milliseconds<br/> Quantiles: 0.9, 0.95, 0.99
jmeter_response_time_histogramHistogramrequestName, requestStatus, responseCode, responseMessage, isTransactionUnit: milliseconds
jmeter_latencySummaryrequestName, requestStatus, responseCode, responseMessage, isTransactionUnit: milliseconds<br/> Quantiles: 0.9, 0.95, 0.99
jmeter_request_sizeSummaryrequestName, requestDirection, isTransactionUnit: bytes
jmeter_assertion_resultsCounterrequestName, failureMessage

Custom metrics

Also, you can create your own custom collectors. See the documentation on Prometheus JVM Client.

Creation

Custom collector creation

Usage

Custom collector usage

Dependency

Plugin is hosted on Maven Central. You can find dependency here. Example use with jmeter-maven-plugin:

<jmeterExtensions>
    <artifact>io.github.kolesnikovm:jmeter-prometheus-listener:x.x.x</artifact>
</jmeterExtensions>

Building

To build, simply run:

gradle clean fatJar