...
At present, it is impossible to perceive the Kafka version that the broker is running from the perspective of metrics. If multiple Kafka versions(not only kafka server, yet other clients, such as producer client, consumer client and so on.) 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
Although there is currently a metric: kafka.server:type=app-info
, which can expose `Version` and `CommitId`, but because they are both string types, the version cannot be collected for monitoring and collection services such as Prometheus. . Therefore, this KIP will add `version` and commitId` to the existing metric: `start-time-ms` in the form of tags. Since the value of `start-time-ms` is of numeric type, Prometheus can collect this metric and obtain the values of version and commitId in the form of parsed tags.
Public Interfaces
- add a kafka version metric for per broker: kafkatags for existed metric: `kafka.server:type=KafkaServer/BrokerServer,name=KafkaVersion
- description: A gauge metric, the value is constant `1`.
- tags: `Map("version" => VersionInfo.getVersion)`
Proposed Changes
- app-info`, its form is below:
- OBJECT_NAME kafka.server:type=app-info,version=3.7.0-SNAPSHOT,commitId=362f7ab130e3ea24
--------------------------------------------------------------------------------------------
NAME VALUE
--------------------------------------------------------------------------------------------
start-time-ms 1697793322366
- OBJECT_NAME kafka.server:type=app-info,version=3.7.0-SNAPSHOT,commitId=362f7ab130e3ea24
Proposed Changes
Add tags for existed metric: `kafka.server:type=app-info`, and obtain the values of version and commitId in the form of parsed tags from collected data from prometheusWhen instantiating kafkaServer/BrokerServer, register `KafkaVersion` gauge metric, whose value is 1, its tag key is "version", its tag value is obtained by `VersionInfo.getVersion`. And remove all related metrics when kafkaServer/BrokerServer shutdown.
Compatibility, Deprecation, and Migration Plan
...