This project includes the source code of the Lightstreamer Metrics Exporter Adapter Set. A ready made Adapter Set for fast deployment into Lightstreamer server and immediate export of numerous metrics for Prometheus monitoring solution out of the box.
This code is designed for Java 8 and greater.
This metrics exporter is intended to be run as a Lightsteamer in-process adapter, exposing Prometheus metrics using a plain Java HttpServer and serving metrics of the local JVM.
The code leverages the Prometheus Java Client and includes the instrumentation logic into a Metadata Adapter class. A custom collector is implemented to proxy metrics coming from local MBeans with a one-to-one mapping between MBean attribute and Prometheus metric. The format of a metric is something like:
<server_name>_<bean_name>_<attribute_name>{beanpropertyName1="beanPropertyValue1", ...}: value
examples:
lightstreamer_Stream_CumulItemUpdates 381.0
lightstreamer_ThreadPool_Throughput{name="EVENTS",} 4.0
lightstreamer_ThreadPool_Throughput{name="PUMP",} 5.997
lightstreamer_ThreadPool_Throughput{name="SNAPSHOT",} 0.0
lightstreamer_DataAdapter_InboundEventFrequency{AdapterSetName="WELCOME",DataAdapterName="CHAT",} 0.0
lightstreamer_DataAdapter_InboundEventFrequency{AdapterSetName="DEMO",DataAdapterName="QUOTE_ADAPTER",} 1.5
Metrics will be accessible at http://localhost:<metrics_port>/
or http://<hostname>:<metrics_port>/
where <hostname>
is the hostanme of the machine and <metrics_port>
is a configuration parameter
in the adapters.xml
file.
Only a subset of all attributes available from JMX are considered for export. Currently the filtering criteria are hard-coded in the enum MBeanFilter, but it is planned to implement the possibility of configuring these criteria through the 'adapters.xml' configuration file.
To install the Lightstreamer Metrics Exporter Adapter Set in your local Lightstreamer Server: get the deploy.zip
file of the latest release, unzip it, and copy the metrics_exporter
folder into the adapters
folder of your Lightstreamer Server installation.
A Lightstreamer Server reboot is needed.
To build your own version of lightstreamer-utility-metricsexporter-adapter-0.1.0
instead of using the one provided in the deploy.zip
file from the Install section above, you have two options:
either use Maven (or other build tools) to take care of dependencies and building (recommended) or gather the necessary jars yourself and build it manually.
For the sake of simplicity only the Maven case is detailed here.
You can easily build and run this application using Maven through the pom.xml file located in the root folder of this project. As an alternative, you can use an alternative build tool (e.g. Gradle, Ivy, etc.) by converting the provided pom.xml file.
Assuming Maven is installed and available in your path you can build the demo by running
mvn install dependency:copy-dependencies
For questions and support please use the Official Forum. The issue list of this page is exclusively for bug reports and feature requests.
- Ensure that JMX Management API is supported by your Lightstreamer Server license configuration.