Hi guys, as I am going to work on Prometheus implementation I should at least add some minimal metric to expose to MetricsProvider.
In order to introduce a MetricsProvided based instrumentation we should eventually drop existing instrumentation and replace with the new system. The challenge would be to not drop 4 letter words API and/or not to duplicate all the instrumentation points. A minimal instrumentation, just to expose some useful value is to add this method to ZooKeeperServer.java, and expose basic data. protected void setupMetrics() { rootMetricsContext.registerGauge("outstanding_requests", () -> { return serverStats.getOutstandingRequests(); }); rootMetricsContext.registerGauge("znode_count", () -> { return zkDb.getNodeCount(); }); rootMetricsContext.registerGauge("watch_count", () -> { return zkDb.getDataTree().getWatchCount(); }); rootMetricsContext.registerGauge("ephemerals_count", () -> { return zkDb.getDataTree().getEphemeralsCount(); }); rootMetricsContext.registerGauge("approximate_data_size", () -> { return zkDb.getDataTree().cachedApproximateDataSize(); }); rootMetricsContext.registerGauge("global_sessions", () -> { return zkDb.getSessionCount(); }); rootMetricsContext.registerGauge("local_sessions", () -> { return sessionTracker.getLocalSessionCount(); }); } This approach is not the one I expect for the long term, as each subsystem (ZkDatabase, Packket Processor)...will have its own specific instrumentation. This can work in the very short term only for "gauges" and not for Summaries (with avg/min/max...) and Counters, which should be collected in-place. Do you have any suggestion ? Enrico