I want to push metrics using java PushGateway client.
Sample PushGateway URL pushgateway.com:9091/metrics/job/job_name
Sample Metrics metrics_name{instance="i1", label1="l1", label2="l2", label3="l3", label4="l4"} value
Can any one please provide me a code snippet to push the above metrics into Pushgateway using Prometheus Java Simpleclient Pushgateway?
Note We have 20K ephemeral instances running of the application hence decided to use Pushgateway.
From the official documentation of PushGateway:
job="directory_cleaner"
,path="/var/tmp"
, the following path will not work:Instead, use the base64 URL-safe encoding for the label value and mark it by suffixing the label name with
@base64
:Here is an example of generating
url
from multiple key-value pair stored inMap<String, String> groupingKey
:Github link