zookeeper icon indicating copy to clipboard operation
zookeeper copied to clipboard

ZOOKEEPER-3982: export ZooKeeper version as prometheus metric

Open maoling opened this issue 5 years ago • 3 comments

  • Apply this patch, we can export ZooKeeper version as prometheus metric. For example:
leader_unavailable_time_sum 0.0
# HELP zk_version_info ZooKeeper version info
# TYPE zk_version_info gauge
zk_version_info{version="3.7.0-SNAPSHOT",revision_hash="b761b77a3bf8cd02edaad88a33bafbc8b6c65be4",built_on="2020-11-07 08:03 UTC",} 1.0
# HELP ensemble_auth_success ensemble_auth_success

maoling avatar Nov 07 '20 08:11 maoling

Why do you want to expose this value only on Prometheus?

@eolivelli Could you please point out what place else I should expose? DefaultMetricsProvider?

maoling avatar Nov 07 '20 12:11 maoling

@eolivelli PTAL. Cc @huizhilu

maoling avatar Jun 28 '21 09:06 maoling

I am not sure we have to write the version to Prometheus. why do you want do to so ?

@eolivelli

  • The version info is a valuable metric for users to diagnose/report issues although we can find this from other ways(e.g., log, JMX, zkServer.sh version).
  • A mature software should have this function in its metric system. Let me give two example:
Example A:
JDK exposes its version metric like this:
jvm_info{version="1.8.0_191-b12",vendor="Oracle Corporation",runtime="Java(TM) SE Runtime Environment",} 1.0

Example B:
Etcd exposes its version metric like this:
curl -L http://localhost:2379/metrics
# HELP etcd_server_version Which version is running. 1 for 'server_version' label with current version.
# TYPE etcd_server_version gauge
etcd_server_version{server_version="3.3.13"} 1

maoling avatar Jul 14 '21 13:07 maoling