Thank you for your answer, Mickael. 
If set the value of gauge to a constant value of 1, adding that tag key is 
"version" and value is the version value of the obtained string type, does this 
solve the problem? We can get the version by tag in prometheus.

best,
hudeqi

"Mickael Maison" <mickael.mai...@gmail.com>写道:
> Hi,
> 
> Prometheus only support numeric values for metrics. This means it's
> not able to handle the kafka.server:type=app-info metric since Kafka
> versions are not valid numbers (3.5.0).
> As a workaround we could create a metric with the version without the
> dots, for example with value 350 for Kafka 3.5.0.
> 
> Also in between releases Kafka uses the -SNAPSHOT suffix (for example
> trunk is currently 3.7.0-SNAPSHOT) so we should also consider a way to
> handle those.
> 
> Thanks,
> Mickael
> 
> On Wed, Aug 30, 2023 at 2:51 PM hudeqi <16120...@bjtu.edu.cn> wrote:
> >
> > Hi, Kamal, thanks your reminding, but I have a question: It seems that I 
> > can't get this metric through "jmx_prometheus"? Although I observed this 
> > metric through other tools.
> >
> > best,
> > hudeqi
> >
> > &quot;Kamal Chandraprakash&quot; &lt;kamal.chandraprak...@gmail.com&gt;写道:
> > > Hi Hudeqi,
> > >
> > > Kafka already emits the version metric. Can you check whether the below
> > > metric satisfies your requirement?
> > >
> > > kafka.server:type=app-info,id=0
> > >
> > > --
> > > Kamal
> > >
> > > On Mon, Aug 28, 2023 at 2:29 PM hudeqi <16120...@bjtu.edu.cn> wrote:
> > >
> > > > Hi, all, I want to submit a minor kip to add a metric, which supports to
> > > > get the running kafka server verison, the wiki url is here
> > > >
> > > > Motivation
> > > >
> > > > At present, it is impossible to perceive the Kafka version that the 
> > > > broker
> > > > is running from the perspective of metrics. If multiple Kafka versions 
> > > > are
> > > > deployed in a cluster due to various reasons, it is difficult for us to
> > > > intuitively understand the version distribution.
> > > >
> > > > So, I want to add a kafka version metric indicating the version of the
> > > > current running kafka server, it can help us to perceive the mixed
> > > > distribution of multiple versions, and to perceive the progress of 
> > > > version
> > > > upgrade in the cluster in real time.
> > > >
> > > > Proposed Changes
> > > >
> > > > When instantiating kafkaServer/BrokerServer, register `KafkaVersion` 
> > > > gauge
> > > > metric, whose value is obtained by `VersionInfo.getVersion`. And remove 
> > > > all
> > > > related metrics when kafkaServer/BrokerServer shutdown.
> > > >
> > > >
> > > >
> > > >
> > > > best,
> > > >
> > > > hudeqi
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >

Reply via email to