BatchCallback () { final Meter meter = TelemetryManager.getInstance().getMeter(VFS); var queriesCounter = meter.counterBuilder("FileNameCache.queries").buildObserver(); var totalMissesCounter = meter.counterBuilder("FileNameCache.totalMisses").buildObserver(); return meter.batchCallback(() -> { long cacheMisses = cacheMissesCount.longValue(); long totalCacheRequestsServed = cacheHitsCount.longValue() + cacheMisses; queriesCounter.record(totalCacheRequestsServed); totalMissesCounter.record(cacheMisses); }, queriesCounter, totalMissesCounter); }