<p>Is it possible to add some metrics to a Java system that will return the version number as a string for the application that is monitored?</p>

<p>I am aiming for a dashboard where each pod, running a Java application inside a Docker container, in a Kubernetes cluster is monitored and the current version of each Java application is viewed.</p>

<p>If it isn't possible, do you have an idea on how to get that information from the Java application and make it available in a Grafana dashboard?</p>

Thomas Sundberg
<p>In your application, you can make available a Gauge metric that uses labels to export e.g. a version number or commit/build hash and then set the value of the gauge to <code>1</code>.</p>

<p>For example, this is how the <code>redis_exporter</code> exports information about a redis instance:</p>

<pre><code># HELP redis_instance_info Information about the Redis instance
# TYPE redis_instance_info gauge
redis_instance_info{addr="redis://localhost:6379",os="Linux 4.4.0-62-generic x86_64",redis_build_id="687a2a319020fa42",redis_mode="standalone",redis_version="3.0.6",role="master"} 1
</code></pre>

<p>You can see the version and a couple of other attributes exported as labels of the metric <code>redis_instance_info</code>.</p>
