sarmbruster / prometheus-example

sample code for exposing application information to prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prometheus-example

This project contains some sample code to expose internal data of a java application to prometheus.

build & run

Just type

./gradlew run

This starts SampleService.java which runs indefinitely. Every 3 secs it picks another random number from 0 to 100 and prints it. That value will also be exposed to prometheus via a http server on port 1234. In a real life scenario that port will be pulled from a prometheus server actively.

There’s also code for using Prometheus pushgateway.

Note
pushgatway code is commented out by default

About

sample code for exposing application information to prometheus


Languages

Language:Java 100.0%